home *** CD-ROM | disk | FTP | other *** search
- /*----------------------------------------------------------------------------
-
- Module name: phigslib.
-
- Author: Toby Howard.
-
- Function: This module contains a collection of
- useful routines, built on top of KRT3.
- See document KRT3/57 for detailed specs.
-
- Dependencies: machine.h.
-
- Internal function list: ptk_setstringprompt, inelemlist, testpoint,
- ptk_redistributepriorities, ptk_findpriority, traversestruct, box
-
- External function list: ptk_readint, ptk_readfloat,
- ptk_readstring, ptk_stackstruct, ptk_unstackstruct,
- ptk_openstruct, ptk_closestruct,
- ptk_getpickid, ptk_elemcount, ptk_structexists,
- ptk_getelemtype, ptk_getelemtypename, ptk_copyelem,
- ptk_getprimname, ptk_removestruct, ptk_findelemtype,
- ptk_countchildren, ptk_structsummary,
- ptk_setattrasf, ptk_setallattrasf, ptk_setedgebundlerec,
- ptk_setinteriorbundlerec, ptk_setpolylinebundlerec,
- ptk_setpolymarkerbundlerec, ptk_settextbundlerec,
- ptk_setstandardviewport, ptk_poststruct, ptk_postrelative,
- ptk_changepostpriority,
- ptk_drawcolourtable, ptk_inqmaxdevicecoords, ptk_inqmaxdevicecoords3,
- ptk_arrow, ptk_grid
-
- Hashtables used: "structureid".
-
- Modification history: (Version), (Date), (name), (Description).
-
- 1.0, ?????, T. Howard, First version.
-
- 1.1, 15th July 1988, S. Larkin, Modified to work with VAX PHIGS.
-
- 1.2, 24th August 1988, S. Larkin, Procedure ptk_drawcolourtable added.
-
- 2.0, 8th January 1991, G. Williams, Converted from Pascal to C. removed
- obsolete functions.
-
- 2.1, 15th February 1991, G. Williams, Function ptk_findelemtype added.
-
- 2.2, 2nd May 1991, G. Williams, Bundled attribute functions added:
- ptk_setattrasf, ptk_setallattrasf, ptk_setedgebundlerec,
- ptk_setinteriorbundlerec, ptk_setpolylinebundlerec,
- ptk_setpolymarkerbundlerec, ptk_settextbundlerec.
-
- 3.0, June 1992, G. Williams, Converted to ISO PHIGS C.
-
- 3.1, July 1992, G. Williams, Extended to support PHIGS PLUS.
-
- ----------------------------------------------------------------------------*/
-
- #include <stdio.h>
- #include <math.h>
- #include <phigs.h>
- #include "ptk.h"
-
- typedef struct ptksstructstack
- {
- Pint structid;
- Pint elemptr;
- struct ptksstructstack *next;
- } ptksstructstack;
-
- typedef struct ptkseditmodestack
- {
- Pedit_mode editmode;
- struct ptkseditmodestack *next;
- } ptkseditmodestack;
-
- static ptksstructstack *structstack = NULL;
- static ptkseditmodestack *editmodestack = NULL;
-
- /* Possibly Implementation dependent, if version has
- ** PHIGS extension elements e.g. DEC
- */
- #ifdef SUN
- #define NUMPHIGSELEMS 103
- #else
- #define NUMPHIGSELEMS 71
- #endif
-
- /* PHIGS PLUS bits */
- static char *elemlist[] =
- {
- "all",
- "nil",
- "polyline3",
- "polyline",
- "polymarker3",
- "polymarker",
- "text3",
- "text",
- "annotation_text_relative3",
- "annotation_text_relative",
- "fill_area3",
- "fill_area",
- "fill_area_set3",
- "fill_area_set",
- "cell_array3",
- "cell_array",
- "generalized_drawing_primitive3",
- "generalized_drawing_primitive",
- "set_polyline_index",
- "set_polymarker_index",
- "set_text_index",
- "set_interior_index",
- "set_edge_index",
- "set_linetype",
- "set_linewidth_scale_factor",
- "set_polyline_colour_index",
- "set_marker_type",
- "set_marker_size_scale_factor",
- "set_polymarker_colour_index",
- "set_text_font",
- "set_text_precision",
- "set_character_expansion_factor",
- "set_character_spacing",
- "set_text_colour_index",
- "set_character_height",
- "set_character_up_vector",
- "set_text_path",
- "set_text_alignment",
- "set_annotation_text_character_height",
- "set_annotation_text_character_up_vector",
- "set_annotation_text_path",
- "set_annotation_text_alignment",
- "set_annotation_style",
- "set_interior_style",
- "set_interior_style_index",
- "set_interior_colour_index",
- "set_edge_flag",
- "set_edgetype",
- "set_edgewidth_scale_factor",
- "set_edge_colour_index",
- "set_pattern_size",
- "set_pattern_reference_point_and_vectors",
- "set_pattern_reference_point",
- "add_names_to_set",
- "remove_names_from_set",
- "set_individual_asf",
- "set_hlhsr_identifier",
- "set_local_transformation3",
- "set_local_transformation",
- "set_global_transformation3",
- "set_global_transformation",
- "set_modelling_clipping_volume3",
- "set_modelling_clipping_volume",
- "set_modelling_clipping_indicator",
- "restore_modelling_clipping_volume",
- "set_view_index",
- "execute_structure",
- "label",
- "application_data",
- "generalized_structure_element",
- "set_pick_identifier",
- #ifdef SUN
- "polyline_set3_with_data",
- "fill_area_set3_with_data",
- "triangle_strip3_with_data",
- "quadrilateral_mesh3_with_data",
- "set_of_fill_area_set3_with_data",
- "non-uniform_b-spline_curve",
- "non-uniform_b-spline_surface",
- "cell_array3_plus",
- "set_text_colour",
- "set_polymarker_colour",
- "set_edge_colour",
- "set_polyline_colour",
- "set_curve_approximation_criteria",
- "set_polyline_shading_method",
- "set_interior_colour",
- "set_back_interior_colour",
- "set_back_interior_style",
- "set_back_interior_style_index",
- "set_reflectance_properties",
- "set_back_reflectance_properties",
- "set_interior_shading_method",
- "set_back_interior_shading_method",
- "set_reflectance_model",
- "set_back_reflectance_model",
- "set_surface_approximation_criteria",
- "set_parametric_surface_characteristics",
- "set_face_distinguishing_mode",
- "set_face_culling_mode",
- "set_light_source_state",
- "set_depth_cue_index",
- "set_colour_mapping_index",
- "set_rendering_colour_model",
- #endif
- };
-
- static char *attrlist[] =
- {
- "polyline",
- "polymarker",
- "text",
- "interior",
- "edge"
- };
-
- #ifdef HP
- static Pstore hpstore;
- static ptkboolean hpstorecreated = FALSE;
- #endif
-
- /*--------------------------------------------------------------------------*/
- /*---------------------- Input Functions -----------------------------------*/
-
- static void ptk_setstringprompt(C(Pint) ws, C(char *) prompt,
- C(Plimit *) echoarea)
- PreANSI(Pint ws)
- PreANSI(char *prompt)
- PreANSI(Plimit *echoarea)
- /*
- ** \parambegin
- ** \param{}{ws}{workstation identifier}{IN}
- ** \param{}{size}{size of the device buffer}{IN}
- ** \param{}{prompt}{prompt string}{IN}
- ** \paramend
- ** \blurb{Initialises the string device to use prompt 'prompt'.}
- */
- {
- Pstring_data stringrec;
-
- /* Implementation dependent code */
- stringrec.in_buf_size = 80;
- stringrec.init_pos = strlen(prompt) + 1;
- #ifdef HP
- stringrec.pets.pet_r1.text_colr_ind = 1;
- #endif
- /* set the echo area to be sensible percentage of device space */
- pinit_string(ws, 1, prompt, 1, echoarea, &stringrec);
- pset_string_mode(ws, 1, POP_REQ, PSWITCH_ECHO);
- } /* ptk_setstringprompt */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern Pint ptk_readint(C(Pint) ws, C(Pint) defint, C(char *) prompt,
- C(Plimit *) echoarea)
- PreANSI(Pint ws)
- PreANSI(Pint defint)
- PreANSI(char *prompt)
- PreANSI(Plimit *echoarea)
- /*
- ** \parambegin
- ** \param{Pint}{ws}{workstation identifier}{IN}
- ** \param{Pint}{defint}{default integer}{IN}
- ** \param{char *}{prompt}{prompt string}{IN}
- ** \param{Plimit *}{echoarea}{string echo area}{IN}
- ** \paramend
- ** \blurb{This function reads and returns an integer from
- ** string device 1 on workstation \pardesc{ws},
- ** using \pardesc{prompt} as a prompt string.
- ** If the user types a carriage-return instead of supplying an
- ** integer, the function returns the specified default value \pardesc{defint}.
- ** \pardesc{echoarea} specifies the echo area to use for the string device.}
- */
- {
- Pin_status status;
- char *str;
- Pint val;
- Pint size;
- Pint pos;
-
- ptk_setstringprompt(ws, prompt, echoarea);
- pos = strlen(prompt);
- str = NULL;
- size = 80;
- str = (char *)malloc(size);
- preq_string(ws, 1, &status, str);
- if (status == PIN_STATUS_OK)
- {
- if (str[pos] == '\0')
- val = defint;
- else
- val = atoi(&str[pos]);
- free(str);
- return val;
- }
- else
- {
- free(str);
- return defint;
- }
- } /* ptk_readint */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern Pfloat ptk_readfloat(C(Pint) ws, C(Pfloat) defreal,
- C(char *) prompt, C(Plimit *) echoarea)
- PreANSI(Pint ws)
- PreANSI(Pfloat defreal)
- PreANSI(char *prompt)
- PreANSI(Plimit *echoarea)
- /*
- ** \parambegin
- ** \param{Pint}{ws}{workstation identifier}{IN}
- ** \param{Pfloat}{defreal}{default floating point number}{IN}
- ** \param{char *}{prompt}{prompt string}{IN}
- ** \param{Plimit *}{echoarea}{string echo area}{IN}
- ** \paramend
- ** \blurb{This function reads and returns a real number from
- ** string device 1 on workstation \pardesc{ws},
- ** using \pardesc{prompt} as a prompt string.
- ** If the user types a carriage-return instead of supplying an
- ** real value, the function returns the specified default value \pardesc{defreal}.
- ** \pardesc{echoarea} specifies the echo area to use for the string device.}
- */
- {
- Pin_status status;
- char *str;
- Pfloat val;
- Pint size;
- Pint pos;
-
- ptk_setstringprompt(ws, prompt, echoarea);
- pos = strlen(prompt);
- str = NULL;
- size = 80;
- str = (char *)malloc(size);
- preq_string(ws, 1, &status, str);
- if (status == PIN_STATUS_OK)
- {
- if (str[pos] == '\0')
- val = defreal;
- else
- val = atof(&str[pos]);
- free(str);
- return val;
- }
- else
- {
- free(str);
- return defreal;
- }
- } /* ptk_readfloat */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_readstring(C(Pint) ws, C(char *) defstring,
- C(char *) prompt, C(Plimit *) echoarea,
- C(Pint) len, C(char *) instr, C(Pint *) inlen)
- PreANSI(Pint ws)
- PreANSI(char *defstring)
- PreANSI(char *prompt)
- PreANSI(Plimit *echoarea)
- PreANSI(Pint len)
- PreANSI(char *instr)
- PreANSI(Pint *inlen)
- /*
- ** \parambegin
- ** \param{Pint}{ws}{workstation identifier}{IN}
- ** \param{char *}{defstring}{default string}{IN}
- ** \param{char *}{prompt}{prompt string}{IN}
- ** \param{Plimit *}{echoarea}{string echo area}{IN}
- ** \param{Pint}{len}{number of characters allocated for input string}{IN}
- ** \param{char *}{instr}{input string}{OUT}
- ** \param{Pint *}{inlen}{length of input string}{OUT}
- ** \paramend
- ** \blurb{This function reads and returns a real number from
- ** string device 1 on workstation \pardesc{ws},
- ** using \pardesc{prompt} as a prompt string.
- ** If the user types a carriage-return instead of supplying a
- ** string, the function returns the specified default value \pardesc{defstring}.
- ** \pardesc{echoarea} specifies the echo area to use for the string device.}
- */
- {
- Pin_status status;
- char *str;
- Pint size;
- Pint pos;
-
- ptk_setstringprompt(ws, prompt, echoarea);
- pos = strlen(prompt);
- str = NULL;
- size = 80;
- str = (char *)malloc(size);
- preq_string(ws, 1, &status, str);
- /* Implementation dependent - PEX-SI returns '\n\0' at the end of every
- ** string when using string input. Replace the \n with \0.
- */
- #ifdef PEXSI
- str[strlen(str) - 1] = '\0';
- #endif
- if (status == PIN_STATUS_OK)
- {
- if (str[pos] == '\0')
- {
- strncpy(instr, defstring, len);
- *inlen = strlen(defstring);
- free(str);
- }
- else
- {
- strncpy(instr, &str[pos], len);
- #ifndef PEXSI
- *inlen = strlen(instr);
- #endif
- #ifdef PEXSI
- *inlen = strlen(instr) - 1;
- #endif
- free(str);
- }
- }
- else
- {
- strncpy(instr, defstring, len);
- *inlen = strlen(defstring);
- free(str);
- }
- } /* ptk_readstring */
-
- /*--------------------------------------------------------------------------*/
- /*------------------------ Structure Functions -----------------------------*/
-
- /*function:external*/
- extern void ptk_stackstruct(C(void))
- /* PreANSI() */
- /*
- ** \blurb{This function stores the name
- ** of the currently open structure, and the position of the element pointer on the
- ** structure
- ** stack, and closes the structure}
- */
- {
- Pint err, stid;
- Popen_struct_status structstatus;
- ptksstructstack *stackitem;
-
- pinq_open_struct(&err, &structstatus, &stid);
- if ((err == 0) && (structstatus == PSTRUCT_OPEN))
- {
- stackitem = (ptksstructstack *)malloc(sizeof(ptksstructstack));
- stackitem->next = structstack;
- structstack = stackitem;
- stackitem->structid = stid;
- pinq_elem_ptr(&err, &stackitem->elemptr);
- pclose_struct();
- }
- } /* ptk_stackstruct */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_unstackstruct(C(void))
- /* PreANSI() */
- /*
- ** \blurb{This function pops the structure stack,
- ** opens the structure and sets the element pointer.}
- */
- {
- ptksstructstack *stackitem;
-
- if (structstack != NULL)
- {
- popen_struct(structstack->structid);
- pset_elem_ptr(structstack->elemptr);
- stackitem = structstack->next;
- free(structstack);
- structstack = stackitem;
- }
- } /* ptk_unstackstruct */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_openstruct(C(Pint) structid)
- PreANSI(Pint structid)
- /*
- ** \parambegin
- ** \param{Pint}{structid}{structure identifier}{IN}
- ** \paramend
- ** \blurb{This function stores the currently open structure and element
- ** pointer on a stack and opens the structure {\tt structid}.}
- */
- {
- Pint err, stid;
- Popen_struct_status structstatus;
- ptksstructstack *stackitem;
-
- ptk_stackstruct();
- popen_struct(structid);
- } /* ptk_openstruct */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_closestruct(C(void))
- /* PreANSI() */
- /*
- ** \blurb{This function closes the currently open structure, and restores the open
- ** structure and element pointer from the structure stack.}
- */
- {
- pclose_struct();
- ptk_unstackstruct();
- } /* ptk_closestruct */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_seteditmode(C(Pedit_mode) editmode)
- PreANSI(Pedit_mode editmode)
- /*
- ** \parambegin
- ** \param{Pedit\_mode}{editmode}{edit mode}{IN}
- ** \paramend
- ** \blurb{This function stores
- ** the current edit mode on the editmode stack and then sets the edit mode
- ** to given value.}
- */
- {
- Pint err;
- Pedit_mode emode;
- Popen_struct_status structstatus;
- ptkseditmodestack *stackitem;
-
- pinq_edit_mode(&err, &emode);
- if (err == 0)
- {
- stackitem = (ptkseditmodestack *)malloc(sizeof(ptkseditmodestack));
- stackitem->next = editmodestack;
- editmodestack = stackitem;
- stackitem->editmode = emode;
- }
- pset_edit_mode(editmode);
- } /* ptk_seteditmode */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_unseteditmode(C(void))
- /* PreANSI() */
- /*
- ** \parambegin
- ** \paramend
- ** \blurb{This function restores the current edit mode from the edit mode stack.}
- */
- {
- ptkseditmodestack *stackitem;
-
- if (editmodestack != NULL)
- {
- pset_edit_mode(editmodestack->editmode);
- stackitem = editmodestack->next;
- free(editmodestack);
- editmodestack = stackitem;
- }
- } /* ptk_unseteditmode */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern ptkboolean ptk_getpickid(C(Pint) stid, C(Pint) elptr, C(Pint *) pickid)
- PreANSI(Pint stid)
- PreANSI(Pint elptr)
- PreANSI(Pint *pickid)
- /*
- ** \parambegin
- ** \param{Pint}{stid}{structure identifier}{IN}
- ** \param{Pint}{elptr}{element pointer value}{IN}
- ** \param{Pint *}{pickid}{pick identifier}{OUT}
- ** \paramend
- ** \blurb{This function inquires the pick identifier at the element position
- ** specified by \pardesc{elptr} in
- ** structure \pardesc{stid}.
- ** The result of the function is TRUE if the element was a pick
- ** identifier, otherwise FALSE.}
- */
- {
- ptkboolean result;
- Pint err;
- Pstore store;
- ptkselcontent elcont;
-
- pcreate_store(&err, &store);
- ptk_inqelemtypesizecontent(stid, elptr, store, &err, &elcont);
- if (elcont.eltype == PELEM_PICK_ID)
- {
- result = TRUE;
- *pickid = elcont.eldata->int_data;
- }
- else
- result = FALSE;
- ptk_delstore(store);
- return result;
- } /* ptk_getpickid */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern ptkboolean ptk_getexecuteid(C(Pint) stid, C(Pint) elptr, C(Pint *) execid)
- PreANSI(Pint stid)
- PreANSI(Pint elptr)
- PreANSI(Pint *execid)
- /*
- ** \parambegin
- ** \param{Pint}{stid}{structure identifier}{IN}
- ** \param{Pint}{elptr}{element pointer value}{IN}
- ** \param{Pint *}{execid}{execute structure identifier}{OUT}
- ** \paramend
- ** \blurb{This function inquires the execute element
- ** identifier at the element position
- ** specified by \pardesc{elptr} in
- ** structure \pardesc{stid}.
- ** The result of the function is TRUE if the element was an execute
- ** element, otherwise FALSE..}
- */
- {
- ptkboolean result;
- Pint err;
- Pstore store;
- ptkselcontent elcont;
-
- pcreate_store(&err, &store);
- ptk_inqelemtypesizecontent(stid, elptr, store, &err, &elcont);
- if (elcont.eltype == PELEM_EXEC_STRUCT)
- {
- result = TRUE;
- *execid = elcont.eldata->int_data;
- }
- else
- result = FALSE;
- ptk_delstore(store);
- return result;
- } /* ptk_getexecuteid */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern Pint ptk_elemcount(C(Pint) stid)
- PreANSI(Pint stid)
- /*
- ** \parambegin
- ** \param{Pint}{stid}{structure identifier}{IN}
- ** \paramend
- ** \blurb{This functions counts the number of elements
- ** in structure \pardesc{stid},
- ** returning the number of elements, or -1 if the structure does
- ** not exist.}
- */
- {
- Pint result;
- Pstruct_status stat;
- Pint openst;
- Popen_struct_status openstat;
- Pint err, p, oldp;
-
- result = 0;
- pinq_struct_status(stid, &err, &stat);
- if (stat == PSTRUCT_STATUS_NON_EXISTENT)
- return -1;
- if (stat == PSTRUCT_STATUS_EMPTY)
- return 0;
- ptk_openstruct(stid);
- pinq_elem_ptr(&err, &p);
- result = p;
- ptk_closestruct();
- return result;
- } /* ptk_elemcount */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern ptkboolean ptk_structexists(C(Pint) stid)
- PreANSI(Pint stid)
- /*
- ** \parambegin
- ** \param{Pint}{stid}{structure identifier}{IN}
- ** \paramend
- ** \blurb{This function checks if structure \pardesc{stid} exists in the CSS,
- ** returning TRUE if it exists, otherwise FALSE.}
- */
- {
- Pstruct_status structstat;
- Pint err;
-
- pinq_struct_status(stid, &err, &structstat);
- if (err == 0)
- return (structstat != PSTRUCT_STATUS_NON_EXISTENT);
- else
- return FALSE;
- } /* ptk_structexists */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_getelemtype(C(char *) elemstr, C(Pelem_type *) eltype)
- PreANSI(char *elemstr)
- PreANSI(Pelem_type *eltype)
- /*
- ** \parambegin
- ** \param{char *}{elemstr}{string giving element type}{IN}
- ** \param{Pelem\_type *}{eltype}{element type}{OUT}
- ** \paramend
- ** \blurb{This function converts the string \pardesc{elemstr}
- ** into its corresponding element type. For example the element type for
- ** "polyline3", would be PEL\_POLYLINE3.}
- */
- {
- Pint ind;
-
- ind = instrlist(elemlist, NUMPHIGSELEMS, elemstr);
- if (ind >= 0)
- *eltype = (Pelem_type)ind;
- else
- *eltype = PELEM_NIL;
- } /* ptk_getelemtype */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_getelemtypename(C(Pelem_type) eltype, C(Pint) size,
- C(char *) elemstr, C(Pint *) totalsize)
- PreANSI(Pelem_type eltype)
- PreANSI(Pint size)
- PreANSI(char *elemstr)
- PreANSI(Pint *totalsize)
- /*
- ** \parambegin
- ** \param{Pelem\_type}{eltype}{element type}{IN}
- ** \param{Pint}{size}{size of buffer allocated by application}{IN}
- ** \param{char *}{elemstr}{string giving element type}{OUT}
- ** \param{Pint *}{totalsize}{length of string}{OUT}
- ** \paramend
- ** \blurb{This function converts element type \pardesc{eltype}
- ** into the corresponding character string, which is returned in
- ** \pardesc{elemstr}. For example, the string corresponding to
- ** PE\_POLYLINE3 would be "polyline3".}
- */
- {
- *totalsize = strlen(elemlist[(Pint)eltype]) + 1;
- if (*totalsize <= size)
- strncpy(elemstr, elemlist[(Pint)eltype], *totalsize);
- } /* ptk_getelemtypename */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_executeelem(C(ptkselcontent *) elcont)
- PreANSI(ptkselcontent *elcont)
- /*
- ** \parambegin
- ** \param{ptkselcontent *}{elcont}{element content}{IN}
- ** \paramend
- ** \blurb{This function creates a structure element which has the
- ** contents \pardesc{elcont}. The element is inserted into the currently open
- ** structure.}
- */
- {
- switch (elcont->eltype)
- {
- case PELEM_POLYLINE3:
- ppolyline3(&elcont->eldata->point_list3);
- break;
-
- case PELEM_POLYLINE:
- ppolyline(&elcont->eldata->point_list);
- break;
-
- case PELEM_POLYMARKER3:
- ppolymarker3(&elcont->eldata->point_list3);
- break;
-
- case PELEM_POLYMARKER:
- ppolymarker(&elcont->eldata->point_list);
- break;
-
- case PELEM_TEXT3:
- ptext3(&elcont->eldata->text3.pos, elcont->eldata->text3.dir,
- elcont->eldata->text3.char_string);
- break;
-
- case PELEM_TEXT:
- ptext(&elcont->eldata->text.pos, elcont->eldata->text.char_string);
- break;
-
- case PELEM_ANNO_TEXT_REL3:
- panno_text_rel3(&elcont->eldata->anno_text_rel3.ref_point,
- &elcont->eldata->anno_text_rel3.offset,
- elcont->eldata->anno_text_rel3.char_string);
- break;
-
- case PELEM_ANNO_TEXT_REL:
- panno_text_rel(&elcont->eldata->anno_text_rel.ref_point,
- &elcont->eldata->anno_text_rel.offset,
- elcont->eldata->anno_text_rel.char_string);
- break;
-
- case PELEM_FILL_AREA3:
- pfill_area3(&elcont->eldata->point_list3);
- break;
-
- case PELEM_FILL_AREA:
- pfill_area(&elcont->eldata->point_list);
- break;
-
- case PELEM_FILL_AREA_SET3:
- pfill_area_set3(&elcont->eldata->point_list_list3);
- break;
-
- case PELEM_FILL_AREA_SET:
- pfill_area_set(&elcont->eldata->point_list_list);
- break;
-
- case PELEM_CELL_ARRAY3:
- #ifndef HP
- pcell_array3(&elcont->eldata->cell_array3.paral,
- &elcont->eldata->cell_array3.colr_array);
- #endif
- break;
-
- case PELEM_CELL_ARRAY:
- #ifndef HP
- pcell_array(&elcont->eldata->cell_array.rect,
- &elcont->eldata->cell_array.colr_array);
- #endif
- break;
-
- case PELEM_GDP3:
- pgdp3(&elcont->eldata->gdp3.point_list,
- elcont->eldata->gdp3.id, &elcont->eldata->gdp3.data);
- break;
-
- case PELEM_GDP:
- pgdp(&elcont->eldata->gdp.point_list,
- elcont->eldata->gdp.id, &elcont->eldata->gdp.data);
- break;
-
- case PELEM_LINE_IND:
- pset_line_ind(elcont->eldata->int_data);
- break;
-
- case PELEM_MARKER_IND:
- pset_marker_ind(elcont->eldata->int_data);
- break;
-
- case PELEM_TEXT_IND:
- pset_text_ind(elcont->eldata->int_data);
- break;
-
- case PELEM_INT_IND:
- pset_int_ind(elcont->eldata->int_data);
- break;
-
- case PELEM_EDGE_IND:
- pset_edge_ind(elcont->eldata->int_data);
- break;
-
- case PELEM_LINETYPE:
- pset_linetype(elcont->eldata->int_data);
- break;
-
- case PELEM_LINEWIDTH:
- pset_linewidth(elcont->eldata->float_data);
- break;
-
- case PELEM_LINE_COLR_IND:
- pset_line_colr_ind(elcont->eldata->int_data);
- break;
-
- case PELEM_MARKER_TYPE:
- pset_marker_type(elcont->eldata->int_data);
- break;
-
- case PELEM_MARKER_SIZE:
- pset_marker_size(elcont->eldata->float_data);
- break;
-
- case PELEM_MARKER_COLR_IND:
- pset_marker_colr_ind(elcont->eldata->int_data);
- break;
-
- case PELEM_TEXT_FONT:
- pset_text_font(elcont->eldata->int_data);
- break;
-
- case PELEM_TEXT_PREC:
- pset_text_prec(elcont->eldata->text_prec);
- break;
-
- case PELEM_CHAR_EXPAN:
- pset_char_expan(elcont->eldata->float_data);
- break;
-
- case PELEM_CHAR_SPACE:
- pset_char_space(elcont->eldata->float_data);
- break;
-
- case PELEM_TEXT_COLR_IND:
- pset_text_colr_ind(elcont->eldata->int_data);
- break;
-
- case PELEM_CHAR_HT:
- pset_char_ht(elcont->eldata->float_data);
- break;
-
- case PELEM_CHAR_UP_VEC:
- pset_char_up_vec(&elcont->eldata->char_up_vec);
- break;
-
- case PELEM_TEXT_PATH:
- pset_text_path(elcont->eldata->text_path);
- break;
-
- case PELEM_TEXT_ALIGN:
- pset_text_align(&elcont->eldata->text_align);
- break;
-
- case PELEM_ANNO_CHAR_HT:
- pset_anno_char_ht(elcont->eldata->float_data);
- break;
-
- case PELEM_ANNO_CHAR_UP_VEC:
- pset_anno_char_up_vec(&elcont->eldata->char_up_vec);
- break;
-
- case PELEM_ANNO_PATH:
- pset_anno_path(elcont->eldata->text_path);
- break;
-
- case PELEM_ANNO_ALIGN:
- pset_anno_align(&elcont->eldata->text_align);
- break;
-
- case PELEM_ANNO_STYLE:
- pset_anno_style(elcont->eldata->int_data);
- break;
-
- case PELEM_INT_STYLE:
- pset_int_style(elcont->eldata->int_data);
- break;
-
- case PELEM_INT_STYLE_IND:
- pset_int_style_ind(elcont->eldata->int_data);
- break;
-
- case PELEM_INT_COLR_IND:
- pset_int_colr_ind(elcont->eldata->int_data);
- break;
-
- case PELEM_EDGE_FLAG:
- pset_edge_flag(elcont->eldata->edge_flag);
- break;
-
- case PELEM_EDGETYPE:
- pset_edgetype(elcont->eldata->int_data);
- break;
-
- case PELEM_EDGEWIDTH:
- pset_edgewidth(elcont->eldata->float_data);
- break;
-
- case PELEM_EDGE_COLR_IND:
- pset_edge_colr_ind(elcont->eldata->int_data);
- break;
-
- case PELEM_PAT_SIZE:
- #ifndef HP
- pset_pat_size(elcont->eldata->pat_size.size_x,
- elcont->eldata->pat_size.size_y);
- #endif
- break;
-
- case PELEM_PAT_REF_POINT_VECS:
- #ifndef HP
- pset_pat_ref_point_vecs(&elcont->eldata->pat_ref_point_vecs.ref_point,
- elcont->eldata->pat_ref_point_vecs.ref_vec);
- #endif
- break;
-
- case PELEM_PAT_REF_POINT:
- #ifndef HP
- pset_pat_ref_point(&elcont->eldata->pat_ref_point);
- #endif
- break;
-
- case PELEM_ADD_NAMES_SET:
- padd_names_set(&elcont->eldata->names);
- break;
-
- case PELEM_REMOVE_NAMES_SET:
- premove_names_set(&elcont->eldata->names);
- break;
-
- case PELEM_INDIV_ASF:
- pset_indiv_asf(elcont->eldata->asf.id, elcont->eldata->asf.source);
- break;
-
- case PELEM_HLHSR_ID:
- pset_hlhsr_id(elcont->eldata->int_data);
- break;
-
- case PELEM_LOCAL_MODEL_TRAN3:
- pset_local_tran3(elcont->eldata->local_tran3.matrix,
- elcont->eldata->local_tran3.compose_type);
- break;
-
- case PELEM_LOCAL_MODEL_TRAN:
- pset_local_tran(elcont->eldata->local_tran.matrix,
- elcont->eldata->local_tran.compose_type);
- break;
-
- case PELEM_GLOBAL_MODEL_TRAN3:
- pset_global_tran3(elcont->eldata->global_tran3);
- break;
-
- case PELEM_GLOBAL_MODEL_TRAN:
- pset_global_tran(elcont->eldata->global_tran);
- break;
-
- case PELEM_MODEL_CLIP_VOL3:
- pset_model_clip_vol3(elcont->eldata->model_clip3.op,
- &elcont->eldata->model_clip3.half_spaces);
- break;
-
- case PELEM_MODEL_CLIP_VOL:
- pset_model_clip_vol(elcont->eldata->model_clip.op,
- &elcont->eldata->model_clip.half_spaces);
- break;
-
- case PELEM_MODEL_CLIP_IND:
- pset_model_clip_ind(elcont->eldata->clip_ind);
- break;
-
- case PELEM_RESTORE_MODEL_CLIP_VOL:
- prestore_model_clip_vol();
- break;
-
- case PELEM_VIEW_IND:
- pset_view_ind(elcont->eldata->int_data);
- break;
-
- case PELEM_EXEC_STRUCT:
- pexec_struct(elcont->eldata->int_data);
- break;
-
- case PELEM_LABEL:
- plabel(elcont->eldata->int_data);
- break;
-
- case PELEM_APPL_DATA:
- pappl_data(&elcont->eldata->appl_data);
- break;
-
- case PELEM_GSE:
- pgse(elcont->eldata->gse.id, &elcont->eldata->gse.data);
- break;
-
- case PELEM_PICK_ID:
- pset_pick_id(elcont->eldata->int_data);
- break;
-
- /* PHIGS PLUS bits */
- #ifdef SUN
- case PELEM_POLYLINE_SET3_DATA:
- ppolyline_set3_data(elcont->eldata->plsd3.vflag,
- elcont->eldata->plsd3.colr_model, elcont->eldata->plsd3.npl,
- elcont->eldata->plsd3.vdata);
- break;
-
- case PELEM_FILL_AREA_SET3_DATA:
- pfill_area_set3_data(elcont->eldata->fasd3.fflag,
- elcont->eldata->fasd3.eflag, elcont->eldata->fasd3.vflag,
- elcont->eldata->fasd3.colr_model,
- &elcont->eldata->fasd3.fdata, elcont->eldata->fasd3.nfa,
- elcont->eldata->fasd3.edata, elcont->eldata->fasd3.vdata);
- break;
-
- case PELEM_TRI_STRIP3_DATA:
- ptri_strip3_data(elcont->eldata->tsd3.fflag,
- elcont->eldata->tsd3.vflag, elcont->eldata->tsd3.colr_model,
- elcont->eldata->tsd3.nv, &elcont->eldata->tsd3.fdata,
- &elcont->eldata->tsd3.vdata);
- break;
-
- case PELEM_QUAD_MESH3_DATA:
- pquad_mesh3_data(elcont->eldata->qmd3.fflag,
- elcont->eldata->qmd3.vflag, elcont->eldata->qmd3.colr_model,
- &elcont->eldata->qmd3.dim, &elcont->eldata->qmd3.fdata,
- &elcont->eldata->qmd3.vdata);
- break;
-
- case PELEM_SET_OF_FILL_AREA_SET3_DATA:
- pset_of_fill_area_set3_data(elcont->eldata->sofas3.fflag,
- elcont->eldata->sofas3.eflag, elcont->eldata->sofas3.vflag,
- elcont->eldata->sofas3.colr_model,
- elcont->eldata->sofas3.num_sets, &elcont->eldata->sofas3.fdata,
- elcont->eldata->sofas3.edata, elcont->eldata->sofas3.vlist,
- &elcont->eldata->sofas3.vdata);
- break;
-
- case PELEM_NUNI_BSP_CURVE:
- pnuni_bsp_curv(elcont->eldata->nurb_curve.order,
- &elcont->eldata->nurb_curve.knots,
- elcont->eldata->nurb_curve.rationality,
- &elcont->eldata->nurb_curve.cpts,
- elcont->eldata->nurb_curve.min, elcont->eldata->nurb_curve.max);
- break;
-
- case PELEM_NUNI_BSP_SURF:
- pnuni_bsp_surf(elcont->eldata->nurb_surf.u_order,
- elcont->eldata->nurb_surf.v_order,
- &elcont->eldata->nurb_surf.uknots,
- &elcont->eldata->nurb_surf.vknots,
- elcont->eldata->nurb_surf.rationality,
- &elcont->eldata->nurb_surf.grid,
- elcont->eldata->nurb_surf.num_trim_loops,
- elcont->eldata->nurb_surf.trim_loops);
- break;
-
- case PELEM_CELL_ARRAY3_PLUS:
- pcell_array3_plus(&elcont->eldata->cell_array_plus.paral,
- &elcont->eldata->cell_array_plus.colr_array.dims,
- elcont->eldata->cell_array_plus.colr_array.type,
- elcont->eldata->cell_array_plus.colr_array.colr_array);
- break;
-
- case PELEM_TEXT_COLR:
- pset_text_colr(&elcont->eldata->colr);
- break;
-
- case PELEM_MARKER_COLR:
- pset_marker_colr(&elcont->eldata->colr);
- break;
-
- case PELEM_EDGE_COLR:
- pset_edge_colr(&elcont->eldata->colr);
- break;
-
- case PELEM_LINE_COLR:
- pset_line_colr(&elcont->eldata->colr);
- break;
-
- case PELEM_CURVE_APPROX_CRIT:
- pset_curve_approx(elcont->eldata->curv_approx.type,
- elcont->eldata->curv_approx.value);
- break;
-
- case PELEM_LINE_SHAD_METH:
- pset_line_shad_meth(elcont->eldata->int_data);
- break;
-
- case PELEM_INT_COLR:
- pset_int_colr(&elcont->eldata->colr);
- break;
-
- case PELEM_BACK_INT_COLR:
- pset_back_int_colr(&elcont->eldata->colr);
- break;
-
- case PELEM_BACK_INT_STYLE:
- pset_back_int_style(elcont->eldata->int_style);
- break;
-
- case PELEM_BACK_INT_STYLE_IND:
- pset_back_int_style_ind(elcont->eldata->int_data);
- break;
-
- case PELEM_REFL_PROPS:
- pset_refl_props(&elcont->eldata->props);
- break;
-
- case PELEM_BACK_REFL_PROPS:
- pset_back_refl_props(&elcont->eldata->props);
- break;
-
- case PELEM_INT_SHAD_METH:
- pset_int_shad_meth(elcont->eldata->int_data);
- break;
-
- case PELEM_BACK_INT_SHAD_METH:
- pset_back_int_shad_meth(elcont->eldata->int_data);
- break;
-
- case PELEM_INT_REFL_EQN:
- pset_refl_eqn(elcont->eldata->int_data);
- break;
-
- case PELEM_BACK_INT_REFL_EQN:
- pset_back_refl_eqn(elcont->eldata->int_data);
- break;
-
- case PELEM_SURF_APPROX_CRIT:
- pset_surf_approx(elcont->eldata->surf_approx.type,
- elcont->eldata->surf_approx.u_val,
- elcont->eldata->surf_approx.v_val);
- break;
-
- case PELEM_PARA_SURF_CHARACS:
- pset_para_surf_characs(elcont->eldata->para_surf_characs.type,
- &elcont->eldata->para_surf_characs.data);
- break;
-
- case PELEM_FACE_DISTING_MODE:
- pset_face_disting_mode(elcont->eldata->disting_mode);
- break;
-
- case PELEM_FACE_CULL_MODE:
- pset_face_cull_mode(elcont->eldata->cull_mode);
- break;
-
- case PELEM_LIGHT_SRC_STATE:
- pset_light_src_state(&elcont->eldata->lss.activation,
- &elcont->eldata->lss.deactivation);
- break;
-
- case PELEM_DCUE_IND:
- pset_dcue_ind(elcont->eldata->int_data);
- break;
-
- case PELEM_COLR_MAP_IND:
- pset_colr_map_ind(elcont->eldata->int_data);
- break;
-
- case PELEM_RENDERING_COLR_MODEL:
- pset_rendering_colr_model(elcont->eldata->int_data);
- break;
-
- #endif
-
- default:
- /* ptk_error(unknown element) */
- break;
- }
- } /* ptk_executeelem */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_copyelem(C(Pint) structid, C(Pint) elemid)
- PreANSI(Pint structid)
- PreANSI(Pint elemid)
- /*
- ** \parambegin
- ** \param{Pint}{structid}{structure identifier}{IN}
- ** \param{Pint}{elemid}{element number}{IN}
- ** \paramend
- ** \blurb{This function copies the element at position \pardesc{elemid}
- ** in structuyre \pardesc{structid}, into the currently
- ** open structure.}
- */
- {
- Pint error, actualsize;
- Pstore store;
- ptkselcontent elcont;
-
- /* find out type and contents of element */
- #ifndef HP
- pcreate_store(&error, &store);
- ptk_inqelemtypesizecontent(structid, elemid, store, &error, &elcont);
- #endif
- #ifdef HP
- if (!hpstorecreated)
- {
- pcreate_store(&error, &hpstore);
- hpstorecreated = TRUE;
- }
- ptk_inqelemtypesizecontent(structid, elemid, hpstore, &error, &elcont);
- #endif
- if (error == 0)
- ptk_executeelem(&elcont);
- ptk_delstore(store);
- } /* ptk_copyelem */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_getprimitivetypename(C(Pattrs) attr, C(Pint) size,
- C(char *) attrstr, C(Pint *) totalsize)
- PreANSI(Pattrs attr)
- PreANSI(Pint size)
- PreANSI(char *attrstr)
- PreANSI(Pint *totalsize)
- /*
- ** \parambegin
- ** \param{Pattrs}{attr}{primitive type}{IN}
- ** \param{Pint}{size}{size of buffer allocated by application}{IN}
- ** \param{char *}{attrstr}{string giving primitive type}{OUT}
- ** \param{Pint *}{totalsize}{length of string}{OUT}
- ** \paramend
- ** \blurb{The function converts the primitive type \pardesc{attr}
- ** to its corresponding character string, which is returned in
- ** \pardesc{artrstr}. For example, P\_POLYLINE would give "polyline".}
- */
- {
- *totalsize = strlen(attrlist[(Pint)attr]) + 1;
- if (*totalsize <= size)
- strncpy(attrstr, attrlist[(Pint)attr], *totalsize);
- } /* ptk_getprimitivetypename */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_copyelemrange(C(Pint) stid, C(Pint) elem1, C(Pint) elem2)
- PreANSI(Pint stid)
- PreANSI(Pint elem1)
- PreANSI(Pint elem2)
- /*
- ** \parambegin
- ** \param{Pint}{stid}{structure identifier}{IN}
- ** \param{Pint}{elem1}{element pointer}{IN}
- ** \param{Pint}{elem2}{element pointer}{IN}
- ** \paramend
- ** \blurb{This function copies the element range \pardesc{elem1} to \pardesc{elem2}
- ** in structure \pardesc{stid} into the currently open structure.}
- */
- {
- Pint i, err, openstid, elemptr, emin, emax;
- Popen_struct_status status;
- ptkboolean backwards;
-
- pinq_open_struct(&err, &status, &openstid);
- if (status == PSTRUCT_OPEN)
- {
- emin = PTKMIN(elem1, elem2);
- emax = PTKMAX(elem1, elem2);
- pinq_elem_ptr(&err, &elemptr);
- if ((openstid == stid) && (elemptr < emin))
- {
- for (i = emin; i <= emax; i++)
- ptk_copyelem(stid, (i * 2) - emin);
- }
- else
- for (i = emin; i <= emax; i++)
- ptk_copyelem(stid, i);
- }
- } /* ptk_copyelemrange */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern ptkboolean ptk_removestruct(C(Pint) stid)
- PreANSI(Pint stid)
- /*
- ** \parambegin
- ** \param{Pint}{stid}{structure identifier}{IN}
- ** \paramend
- ** \blurb{This function deletes structure \pardesc{stid}, if it already exists,
- ** returning TRUE if the structure was deleted, otherwise FALSE.}
- */
- {
- if (ptk_structexists(stid))
- {
- pdel_struct(stid);
- return TRUE;
- }
- else
- return FALSE;
- } /* ptk_removestruct */
-
- /*--------------------------------------------------------------------------*/
-
- static ptkboolean inelemlist(C(Pelem_type *) elemlist, C(Pint) lenlist,
- C(Pelem_type) elem, C(Pint *) lstnum)
- PreANSI(Pelem_type *elemlist)
- PreANSI(Pint lenlist)
- PreANSI(Pelem_type elem)
- PreANSI(Pint *lstnum)
- /*
- ** \parambegin
- ** \param{}{elemlist}{list of element types}{IN}
- ** \param{}{lenlist}{length of element type list}{IN}
- ** \param{}{elem}{element type to search for}{IN}
- ** \param{}{lstnum}{index of found item in list}{OUT}
- ** \paramend
- ** \blurb{This function searches \pardesc{elemlist} for an
- ** element of type \pardesc{elem}, returning
- ** TRUE if the element type is found in list, otherwise FALSE.}
- */
- {
- Pint i;
- ptkboolean found;
-
- i = 0;
- found = FALSE;
- while ((found == FALSE) && (i < lenlist))
- {
- if (elemlist[i] == elem)
- {
- found = TRUE;
- *lstnum = i;
- }
- i++;
- }
- return found;
- }
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_findelemtype(C(Pelem_type *) eltypelst, C(Pint) lenlst,
- C(Psearch_dir) srchdir, C(Psearch_status *) srchstat,
- C(Pint *) elptr, C(Pint *) lstnum)
- PreANSI(Pelem_type *eltypelst)
- PreANSI(Pint lenlst)
- PreANSI(Psearch_dir srchdir)
- PreANSI(Psearch_status *srchstat)
- PreANSI(Pint *elptr)
- PreANSI(Pint *lstnum)
- /*
- ** \parambegin
- ** \param{Pelem\_type *}{eltypelst}{list of element types}{IN}
- ** \param{Pint}{lenlst}{length of element type list}{IN}
- ** \param{Psearch\_dir}{srchdir}{search direction, forwards or backwards}{IN}
- ** \param{Psearch\_status *}{srchstat}{search success or failure}{OUT}
- ** \param{Pint *}{elptr}{found element pointer}{OUT}
- ** \param{Pint *}{lstnum}{index of found item in list}{OUT}
- ** \paramend
- ** \blurb{This function searches
- ** the currently open
- ** structure, starting at the current element pointer and proceeding in
- ** direction \pardesc{srchdir}, for the first element whose type
- ** matches any of those given in \pardesc{contentlst}.}
- */
- {
- Pint structid, elemptr;
- Pint err;
- Popen_struct_status status;
- Pint maxelems;
- Pelem_type etype;
- size_t esize;
-
- pinq_open_struct(&err, &status, &structid);
- if (status == PSTRUCT_NONE)
- {
- /* ptk_error("no open structure"); */
- }
- else
- {
- pinq_elem_ptr(&err, &elemptr);
- maxelems = ptk_elemcount(structid);
- *srchstat = PSEARCH_STATUS_FAILURE;
- while ((*srchstat == PSEARCH_STATUS_FAILURE) && (elemptr >= 0)
- && (elemptr <= maxelems))
- {
- pset_elem_ptr(elemptr);
- pinq_cur_elem_type_size(&err, &etype, &esize);
- if (inelemlist(eltypelst, lenlst, etype, lstnum))
- {
- *srchstat = PSEARCH_STATUS_SUCCESS;
- *elptr = elemptr;
- }
- else
- {
- if (srchdir == PDIR_FORWARD)
- elemptr++;
- else
- elemptr--;
- }
- }
- }
- } /* ptk_findelemtype */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern ptkboolean ptk_findnextpickid(C(Pint) stid, C(Psearch_dir) srchdir,
- C(Pint *) eltptr, C(Pint *) pickid)
- PreANSI(Pint stid)
- PreANSI(Psearch_dir srchdir)
- PreANSI(Pint *eltptr)
- PreANSI(Pint *pickid)
- /*
- ** \parambegin
- ** \param{Pint}{stid}{structure identifier}{IN}
- ** \param{Psearch\_dir}{srchdir}{search direction}{IN}
- ** \param{Pint *}{eltptr}{element pointer of pick identifier}{OUT}
- ** \param{Pint *}{pickid}{pick identifier value}{OUT}
- ** \paramend
- ** \blurb{This function searches structure \pardesc{stid}, starting
- ** at element \pardesc{elptr} and proceeding in direction \pardesc{srchdir},
- ** looking for a pick identifier structure element. The function
- ** returns TRUE if a pick identifier was found, otherwise FALSE.}
- */
- {
- Pint openst;
- Popen_struct_status openstat;
- Pint err, oldp;
- ptkboolean result;
- Pint stat;
- Psearch_status searchstat;
- Pelem_type eltype;
- Pint lenlist, lstnum;
-
- ptk_openstruct(stid);
- pset_elem_ptr(*eltptr);
- eltype = PELEM_PICK_ID;
- lenlist = 1;
- ptk_findelemtype(&eltype, lenlist, srchdir, &searchstat, eltptr, &lstnum);
- ptk_closestruct();
- if (searchstat == PSEARCH_STATUS_SUCCESS)
- {
- ptk_getpickid(stid, *eltptr, pickid);
- result = TRUE;
- }
- else
- result = FALSE;
- return result;
- } /* ptk_findnextpickid */
-
- /*------------------------------------------------------------------------*/
-
- /*function:external*/
- extern ptkboolean ptk_findlabel(C(Pint) label, C(Pint *) elemptr)
- PreANSI(Pint label)
- PreANSI(Pint *elemptr)
- /*
- ** \parambegin
- ** \param{Pint}{label}{label value}{IN}
- ** \param{Pint *}{elemptr}{element pointer of label element}{IN/OUT}
- ** \paramend
- ** \blurb{This function searches forwards through the currently open
- ** structure from the current editing position
- ** looking for a label structure element. The function
- ** returns TRUE if {\tt label} was found, otherwise FALSE.}
- */
- {
- ptkboolean found;
- Pint err, eptr;
- Pstore store;
- ptkselcontent elcont;
-
- found = FALSE;
- pset_elem_ptr_label(label);
- pinq_elem_ptr(&err, &eptr);
- pcreate_store(&err, &store);
- ptk_inqcurelemtypesizecontent(store, &err, &elcont);
- if (elcont.eltype == PELEM_LABEL)
- if (elcont.eldata->int_data = label)
- {
- found = TRUE;
- *elemptr = eptr;
- }
- ptk_delstore(store);
- return found;
- } /* ptk_findlabel */
-
- /*------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_delelemtype(C(Pint) stid, C(Pint) lenlst,
- C(Pelem_type *) eltypelst)
- PreANSI(Pint stid)
- PreANSI(Pint lenlst)
- PreANSI(Pelem_type *eltypelst)
- /*
- ** \parambegin
- ** \param{Pint}{stid}{structure identifier}{IN}
- ** \param{Pint}{lenlst}{length of element type list}{IN}
- ** \param{Pelem\_type *}{eltypelst}{list of element types to delete}{IN}
- ** \paramend
- ** \blurb{This function deletes every element in structure \pardesc{stid}, whose
- ** type matches one of the types in \pardesc{eltypelst}}.
- */
- {
- ptkboolean finished;
- Psearch_status srchstatus;
- Pint elptr, lstnum;
-
- finished = FALSE;
- elptr = 0;
- ptk_openstruct(stid);
- pset_elem_ptr(elptr);
- while (!finished)
- {
- ptk_findelemtype(eltypelst, lenlst, PDIR_FORWARD, &srchstatus,
- &elptr, &lstnum);
- if (srchstatus == PSEARCH_STATUS_SUCCESS)
- {
- pset_elem_ptr(elptr);
- pdel_elem();
- }
- else
- finished = TRUE;
- }
- ptk_closestruct();
- } /* ptk_delelemtype */
-
- /*------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_delelem(C(Pint) numelems)
- PreANSI(Pint numelems)
- /*
- ** \parambegin
- ** \param{Pint}{numelems}{number of elements to delete}{IN}
- ** \paramend
- ** \blurb{This function deletes the \pardesc{numelms} elements from the
- ** open structure, starting at the element pointer. If \pardesc{numelems} is
- ** 0, all elements up to the end of
- ** the structure are deleted.}
- */
- {
- Pint i, range, err, elptr, stid, maxelems;
- Popen_struct_status status;
-
- if (numelems == 0)
- {
- pinq_open_struct(&err, &status, &stid);
- pinq_elem_ptr(&err, &elptr);
- maxelems = ptk_elemcount(stid);
- range = maxelems - elptr;
- }
- else
- range = numelems;
- for (i = 0; i < range; i++)
- {
- pdel_elem();
- poffset_elem_ptr(1);
- }
- poffset_elem_ptr(-1);
- } /* ptk_delelem */
-
- /*------------------------------------------------------------------------*/
-
- /*function:external*/
- extern Pint ptk_countchildren(C(Pint) stid)
- PreANSI(Pint stid)
- /*
- ** \parambegin
- ** \param{Pint}{stid}{structure identifier}{IN}
- ** \paramend
- ** \blurb{The function returns the number of structures executed by structure
- ** \pardesc{stid}.
- ** This is the number of direct execute elements in the structure.}
- */
- {
- Pint e, c, err, foundel, numels;
- Psearch_status status;
- Pelem_type exectype;
- Pelem_type_list includelst, excludelst;
- Popen_struct_status openstatus;
-
- e = 0;
- c = 0;
- numels = ptk_elemcount(stid);
- includelst.num_elem_types = 1;
- exectype = PELEM_EXEC_STRUCT;
- includelst.elem_types = &exectype;
- excludelst.num_elem_types = 0;
- excludelst.elem_types = NULL;
- do
- {
- pelem_search(stid, e, PDIR_FORWARD, &includelst, &excludelst, &err,
- &status, &foundel);
- e = foundel + 1;
- if (status == PSEARCH_STATUS_SUCCESS)
- c++;
- } while ((status != PSEARCH_STATUS_FAILURE) && (e <= numels));
- return c;
- } /* ptk_countchildren */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern Pint ptk_countuniqchildren(C(Pint) stid)
- PreANSI(Pint stid)
- /*
- ** \parambegin
- ** \param{Pint}{stid}{structure identifier}{IN}
- ** \paramend
- ** \blurb{This function returns the number of unique children of structure
- ** \pardesc{stid}. Thus, if a structure executed structures A, B and C, it would
- ** have 3 unique children, regardless of how many times each of A, B and C were
- ** executed.}
- */
- {
- Pint e, err, foundel, numels, childstid[255];
- Psearch_status status;
- Pelem_type exectype;
- Pelem_type_list includelst, excludelst;
- Popen_struct_status openstatus;
- Pint_list children;
- Pstore store;
- ptkselcontent elcont;
-
- e = 0;
- children.num_ints = 0;
- children.ints = childstid;
- numels = ptk_elemcount(stid);
- includelst.num_elem_types = 1;
- exectype = PELEM_EXEC_STRUCT;
- includelst.elem_types = &exectype;
- excludelst.num_elem_types = 0;
- excludelst.elem_types = NULL;
- do
- {
- pelem_search(stid, e, PDIR_FORWARD, &includelst, &excludelst, &err,
- &status, &foundel);
- e = foundel + 1;
- if (status == PSEARCH_STATUS_SUCCESS)
- {
- pcreate_store(&err, &store);
- ptk_inqelemtypesizecontent(stid, foundel, store, &err, &elcont);
- if (inintlst(elcont.eldata->int_data, &children) == -1)
- children.ints[children.num_ints++] = elcont.eldata->int_data;
- ptk_delstore(store);
- }
- } while ((status != PSEARCH_STATUS_FAILURE) && (e <= numels));
- return children.num_ints;
- } /* ptk_countuniqchildren */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_inqstructnetids(C(Pint) root, C(Pint) size,
- C(Pint_list *) stids, C(Pint *) totalsize)
- PreANSI(Pint root)
- PreANSI(Pint size)
- PreANSI(Pint_list *stids)
- PreANSI(Pint *totalsize)
- /*
- ** \parambegin
- ** \param{Pint}{root}{structure network identifer}{IN}
- ** \param{Pint}{size}{number of integers allocated in integer list}{IN}
- ** \param{Pint\_list *}{stids}{list of structure identifiers}{OUT}
- ** \param{Pint *}{totalsize}{actual number of integers in integer list}{OUT}
- ** \paramend
- ** \blurb{This function returns a
- ** list of structure identifiers in the structure network whose
- ** root is \pardesc{root}.}
- */
- {
- Pint_list stidlist;
- Pint ids[500];
- Pint err, i, j;
- Ppath_order order;
- Pstore store;
- Pelem_ref_list_list *paths;
-
- stidlist.num_ints = 0;
- stidlist.ints = ids;
- pcreate_store(&err, &store);
- pinq_paths_descs(root, PORDER_TOP_FIRST, 0, store, &err, &paths);
- for (i = 0; i < paths->num_elem_ref_lists; i++)
- {
- for (j = 0; j < paths->elem_ref_lists[i].num_elem_refs; j++)
- {
- if (inintlst(paths->elem_ref_lists[i].elem_refs[j].struct_id,
- &stidlist) == -1)
- stidlist.ints[stidlist.num_ints++] =
- paths->elem_ref_lists[i].elem_refs[j].struct_id;
- }
- }
- ptk_delstore(store);
- if (ptk_structexists(root) && (stidlist.num_ints == 0))
- stidlist.ints[stidlist.num_ints++] = root;
- stids->num_ints = *totalsize = stidlist.num_ints;
- if (size >= stidlist.num_ints)
- {
- for (i = 0; i < stidlist.num_ints; i++)
- stids->ints[i] = stidlist.ints[i];
- }
- } /* ptk_inqstructnetids */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_structsummary(C(FILE *) fileptr)
- PreANSI(FILE *fileptr)
- /*
- ** \parambegin
- ** \param{FILE *}{fileptr}{file pointer}{IN}
- ** \paramend
- ** \blurb{This function outputs a summary of all the structures in the CSS to
- ** file \pardesc{fileptr}, which should be an open writeable file.
- ** The structure identifier of each structure is printed, together
- ** with its hashed string name, if it has one. The format
- ** of the list is: {\tt \\
- ** \ \ \ \ \ List of structures in the CSS\\
- ** \ \ \ \ \ -----------------------------\\
- ** \ \\
- ** \ \ \ \ \ structure 1 "helicopter"\\
- ** \ \ \ \ \ structure 45 \\
- ** \ \ \ \ \ structure 51 "helicopter"\\
- ** \ \ \ \ \ etc. }
- ** .}
- */
- {
- Pint length, totallength;
- Pint_list stlist;
- Pint *stids;
- Pint error, stringlen;
- char str[255];
- Pint i;
- ptkboolean dostring;
-
- length = 0;
- pinq_struct_ids(length, 0, &error, &stlist, &totallength);
- length = totallength;
- stids = (Pint *)calloc(length, sizeof(Pint));
- stlist.ints = stids;
- pinq_struct_ids(length, 0, &error, &stlist, &totallength);
- if (error != 0)
- {
- /* ptk_error(error in ptk_structsummary) */
- return;
- }
- dostring = ptk_hashtableused("structureid");
- fprintf(fileptr, "List of structures in the CSS\n");
- fprintf(fileptr, "-----------------------------\n");
- for (i = 0; i < stlist.num_ints; i++)
- {
- fprintf(fileptr, "structure %d", stlist.ints[i]);
-
- /* get corresponding string for structure id from hashtable */
- if (dostring)
- {
- ptk_inttostring("structureid", stlist.ints[i], 255, str,
- &totallength);
-
- /* print string, if there is one */
- if (totallength == 0)
- fprintf(fileptr, "\n");
- else
- {
- fprintf(fileptr, " \"%s\"\n", str);
- }
- }
- else
- fprintf(fileptr, "\n");
- }
- } /* ptk_structsummary */
-
- /*--------------------------------------------------------------------------*/
- /*--------------------- Attribute Functions --------------------------------*/
-
- /*function:external*/
- extern void ptk_setattrasf(C(Pint) numattrs, C(Paspect *) attrs, C(Pasf) asf)
- PreANSI(Pint numattrs)
- PreANSI(Paspect *attrs)
- PreANSI(Pasf asf)
- /*
- ** \parambegin
- ** \param{Pint}{numattrs}{length of attribute list}{IN}
- ** \param{Paspect *}{attrs}{attribute list}{IN}
- ** \param{Pasf}{asf}{aspect source flag}{IN}
- ** \paramend
- ** \blurb{This function inserts a structure element into
- ** the open structure to set the aspect source flags for each of the
- ** \pardesc{numattrs} attributes in the
- ** list \pardesc{attrs}, according to \pardesc{asf}.}
- */
- {
- Pint i;
-
- for (i = 0; i < numattrs; i++)
- pset_indiv_asf(attrs[i], asf);
- } /* ptk_setattrasf */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_setallattrasf(C(Pasf) asf)
- PreANSI(Pasf asf)
- /*
- ** \parambegin
- ** \param{Pasf}{asf}{aspect source flag}{IN}
- ** \paramend
- ** \blurb{This function inserts a structure element into
- ** the open structure to set the aspect source flags for all primitive
- ** attributes, according to \pardesc{asf}.}
- */
- {
- /* PHIGS PLUS bits */
- #ifdef SUN
- static Pint numattr = 30;
- static Paspect attrlist[] = {PASPECT_LINETYPE, PASPECT_LINEWIDTH,
- PASPECT_LINE_COLR_IND, PASPECT_MARKER_TYPE, PASPECT_MARKER_SIZE,
- PASPECT_MARKER_COLR_IND, PASPECT_TEXT_FONT, PASPECT_TEXT_PREC,
- PASPECT_CHAR_EXPAN, PASPECT_CHAR_SPACE, PASPECT_TEXT_COLR_IND,
- PASPECT_INT_STYLE, PASPECT_INT_STYLE_IND, PASPECT_INT_COLR_IND,
- PASPECT_EDGE_FLAG, PASPECT_EDGETYPE, PASPECT_EDGEWIDTH,
- PASPECT_EDGE_COLR_IND,
- PASPECT_LINE_SHAD_METH, PASPECT_INT_SHAD_METH,
- PASPECT_REFL_PROPS, PASPECT_INT_REFL_EQN,
- PASPECT_BACK_INT_STYLE, PASPECT_BACK_INT_STYLE_IND,
- PASPECT_BACK_INT_COLR, PASPECT_BACK_INT_SHAD_METH,
- PASPECT_BACK_REFL_PROPS, PASPECT_BACK_INT_REFL_EQN,
- PASPECT_CURVE_APPROX_CRIT, PASPECT_SURF_APPROX_CRIT};
- #else
- static Pint numattr = 18;
- static Paspect attrlist[] = {PASPECT_LINETYPE, PASPECT_LINEWIDTH,
- PASPECT_LINE_COLR_IND, PASPECT_MARKER_TYPE, PASPECT_MARKER_SIZE,
- PASPECT_MARKER_COLR_IND, PASPECT_TEXT_FONT, PASPECT_TEXT_PREC,
- PASPECT_CHAR_EXPAN, PASPECT_CHAR_SPACE, PASPECT_TEXT_COLR_IND,
- PASPECT_INT_STYLE, PASPECT_INT_STYLE_IND, PASPECT_INT_COLR_IND,
- PASPECT_EDGE_FLAG, PASPECT_EDGETYPE, PASPECT_EDGEWIDTH,
- PASPECT_EDGE_COLR_IND};
- #endif
- ptk_setattrasf(numattr, attrlist, asf);
- } /* ptk_setallattrasf */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern Pedge_bundle ptk_setedgebundlerec(C(Pedge_flag) eflag, C(Pint) etype,
- C(Pfloat) escale, C(Pint) ecolour)
- PreANSI(Pedge_flag eflag)
- PreANSI(Pint etype)
- PreANSI(Pfloat escale)
- PreANSI(Pint ecolour)
- /*
- ** \parambegin
- ** \param{Pedge\_flag}{eflag}{edge on or off}{IN}
- ** \param{Pint}{etype}{edge type (solid, dotted,..)}{IN}
- ** \param{Pfloat}{escale}{edge width scale factor}{IN}
- ** \param{Pint}{ecolour}{edge colour index}{IN}
- ** \paramend
- ** \blurb{This function sets creates and
- ** returns an edge bundle attribute record whose fields are set as specified.}
- */
- {
- Pedge_bundle edgerec;
-
- edgerec.flag = eflag;
- edgerec.type = etype;
- edgerec.width = escale;
- edgerec.colr_ind = ecolour;
- return edgerec;
- } /* ptk_setedgebundlerec */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern Pint_bundle ptk_setinteriorbundlerec(C(Pint_style) istyle,
- C(Pint) index, C(Pint) icolour)
- PreANSI(Pint_style istyle)
- PreANSI(Pint index)
- PreANSI(Pint icolour)
- /*
- ** \parambegin
- ** \param{Pint\_style}{istyle}{interior style (solid, hollow,..)}{IN}
- ** \param{Pint}{index}{interior style index for pattern or hatch}{IN}
- ** \param{Pint}{icolour}{interior colour index}{IN}
- ** \paramend
- ** \blurb{This function sets creates and
- ** returns an interior bundle attribute record whose fields are set as specified.}
- */
- {
- Pint_bundle inrec;
-
- inrec.style = istyle;
- inrec.style_ind = index;
- inrec.colr_ind = icolour;
- return inrec;
- } /* ptk_setinteriorbundlerec */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern Pline_bundle ptk_setpolylinebundlerec(C(Pint) ltype, C(Pfloat) lwidth,
- C(Pint) lcolour)
- PreANSI(Pint ltype)
- PreANSI(Pfloat lwidth)
- PreANSI(Pint lcolour)
- /*
- ** \parambegin
- ** \param{Pint}{ltype}{line type (solid, dotted,..)}{IN}
- ** \param{Pfloat}{lwidth}{line width scale factor}{IN}
- ** \param{Pint}{lcolour}{line colour index}{IN}
- ** \paramend
- ** \blurb{This function sets creates and
- ** returns a polyline bundle attribute record whose fields are set as specified.}
- */
- {
- Pline_bundle lnrec;
-
- lnrec.type = ltype;
- lnrec.width = lwidth;
- lnrec.colr_ind = lcolour;
- return lnrec;
- } /* ptk_setpolylinebundlerec */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern Pmarker_bundle ptk_setpolymarkerbundlerec(C(Pint) mtype, C(Pfloat) msize,
- C(Pint) mcolour)
- PreANSI(Pint mtype)
- PreANSI(Pfloat msize)
- PreANSI(Pint mcolour)
- /*
- ** \parambegin
- ** \param{Pint}{mtype}{marker type (dot, circle,..)}{IN}
- ** \param{Pfloat}{msize}{marker size scale factor}{IN}
- ** \param{Pint}{mcolour}{marker colour index}{IN}
- ** \paramend
- ** \blurb{This function sets creates and
- ** returns an polymarker bundle attribute record whose fields are set as specified.}
- */
- {
- Pmarker_bundle mkrec;
-
- mkrec.type = mtype;
- mkrec.size = msize;
- mkrec.colr_ind = mcolour;
- return mkrec;
- } /* ptk_setpolymarkerbundlerec */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern Ptext_bundle ptk_settextbundlerec(C(Pint) tfont, C(Ptext_prec) tprec,
- C(Pfloat) texp, C(Pfloat) tspace, C(Pint) tcolour)
- PreANSI(Pint tfont)
- PreANSI(Ptext_prec tprec)
- PreANSI(Pfloat texp)
- PreANSI(Pfloat tspace)
- PreANSI(Pint tcolour)
- /*
- ** \parambegin
- ** \param{Pint}{tfont}{text font}{IN}
- ** \param{Ptext\_prec}{tprec}{text precision}{IN}
- ** \param{Pfloat}{texp}{character expansion factor}{IN}
- ** \param{Pfloat}{tspace}{character spacing}{IN}
- ** \param{Pint}{tcolour}{text colour index}{IN}
- ** \paramend
- ** \blurb{This function sets creates and
- ** returns a text bundle attribute record whose fields are set as specified.}
- */
- {
- Ptext_bundle txrec;
-
- txrec.font = tfont;
- txrec.prec = tprec;
- txrec.char_expan = texp;
- txrec.char_space = tspace;
- txrec.colr_ind = tcolour;
- return txrec;
- } /* ptk_settextbundlerec */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_computecharsize(C(Pint) wsid, C(char *) str, C(Ppoint *) box,
- C(Pint) font, C(Pfloat *) charht,
- C(Pfloat *) charexp)
- PreANSI(Pint wsid)
- PreANSI(char *str)
- PreANSI(Ppoint *box)
- PreANSI(Pint font)
- PreANSI(Pfloat *charht)
- PreANSI(Pfloat *charexp)
- /*
- ** \parambegin
- ** \param{Pint}{wsid}{workstation identifier}{IN}
- ** \param{char *}{str}{string}{IN}
- ** \param{Ppoint *}{box}{width and height of box}{IN}
- ** \param{Pint}{font}{text font}{IN}
- ** \param{Pfloat *}{charht}{character height}{OUT}
- ** \param{Pfloat *}{charexp}{character expansion}{OUT}
- ** \paramend
- ** \blurb{This function computes the character height and expansion for
- ** string \pardesc{str}, using font \pardesc{font},
- ** in order for it to fit into the rectangle specifed by \pardesc{box}.}
- */
- {
- Pint err, totsize, wstype;
- Pstore store;
- void *connid;
- Prect rect;
- Ppoint offset;
- Pfloat stringwidth, charheight;
-
- #ifdef SUN
- pcreate_store(&err, &store);
- pinq_ws_conn_type(wsid, store, &err, &connid, &wstype);
- pinq_text_extent(wstype, font, 1.0, 0.0, 0.01, PPATH_RIGHT,
- PHOR_NORM, PVERT_NORM, str, &err, &rect, &offset);
-
- charheight = rect.q.y - rect.p.y;
- *charht = 0.01 * (box->y/charheight);
-
- pinq_text_extent(wstype, font, 1.0, 0.0, *charht, PPATH_RIGHT,
- PHOR_NORM, PVERT_NORM, str, &err, &rect, &offset);
- stringwidth = rect.q.x - rect.p.x;
- *charexp = 1.0 * (box->x/stringwidth);
- ptk_delstore(store);
- #endif
- #ifndef SUN
- /* do for HP and PEXSI */
- charheight = box->y;
- stringwidth = strlen(str) * charheight;
- *charht = charheight;
- *charexp = 1.0 * (box->x/stringwidth);
- #endif
- } /* ptk_computecharsize */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_computecharheight(C(Pint) wsid, C(char *) str,
- C(Ppoint *) box, C(Pint) font, C(Pfloat *) charht)
- PreANSI(Pint wsid)
- PreANSI(char *str)
- PreANSI(Ppoint *box)
- PreANSI(Pint font)
- PreANSI(Pfloat *charht)
- /*
- ** \parambegin
- ** \param{Pint}{wsid}{workstation identifier}{IN}
- ** \param{char *}{str}{string}{IN}
- ** \param{Ppoint *}{box}{width and height of box}{IN}
- ** \param{Pint}{font}{text font}{IN}
- ** \param{Pfloat *}{charht}{character height}{OUT}
- ** \paramend
- ** \blurb{This function computes the character height for
- ** string \pardesc{str}, using font \pardesc{font},
- ** in order for it to fit into the rectangle specifed by \pardesc{box}.}
- */
- {
- Pint err, totsize, wstype;
- Pstore store;
- void *connid;
- Prect rect;
- Ppoint offset;
- Pfloat stringwidth, charheight, width, height;
-
- #ifdef SUN
- pcreate_store(&err, &store);
- pinq_ws_conn_type(wsid, store, &err, &connid, &wstype);
- pinq_text_extent(wstype, font, 1.0, 0.0, 0.01, PPATH_RIGHT,
- PHOR_NORM, PVERT_NORM, str, &err, &rect, &offset);
- ptk_delstore(store);
- charheight = rect.q.y - rect.p.y;
- stringwidth = rect.q.x - rect.p.x;
- height = 0.01 * (box->y / charheight);
- width = stringwidth * (height / 0.01);
- if (width > box->x)
- height *= (box->x / width);
- *charht = height;
- #endif
- #ifndef SUN
- /* do for HP and PEXSI */
- /* assume mono-spaced font, font = 1, path = right */
- charheight = box->y;
- stringwidth = strlen(str) * box->y;
- if (stringwidth > box->x)
- charheight *= (box->x / stringwidth);
- *charht = charheight;
- #endif
- } /* ptk_computecharheight */
-
- /*--------------------------------------------------------------------------*/
- /*----------------------- Viewing Functions --------------------------------*/
-
- /*function:external*/
- extern void ptk_setstandardviewport(C(Plimit3 *) vlimits, C(Pview_rep3 *) rep)
- PreANSI(Plimit3 *vlimits)
- PreANSI(Pview_rep3 *rep)
- /*
- ** \parambegin
- ** \param{Plimit3 *}{vlimits}{viewport bounding box}{IN}
- ** \param{Pview\_rep3 *}{rep}{view representation}{OUT}
- ** \paramend
- ** \blurb{For a window of [0,1], this function creates in \pardesc{rep}
- ** a view representation
- ** for a viewport of
- ** \pardesc{vlimits}.}
- */
- {
- Pview_map3 viewmap;
- Pint err;
-
- viewmap.view_plane = 1.0;
- viewmap.proj_type = PTYPE_PARAL;
- viewmap.proj_ref_point = ptk_point3(0.5, 0.5, 2.0);
- viewmap.win = ptk_limit(0.0, 1.0, 0.0, 1.0);
- viewmap.back_plane = -1.0;
- viewmap.front_plane = 1.0;
- viewmap.proj_vp = *vlimits;
- peval_view_map_matrix3(&viewmap, &err, rep->map_matrix);
- ptk_unitmatrix3(rep->ori_matrix);
- rep->clip_limit = *vlimits;
- rep->xy_clip = PIND_CLIP;
- rep->front_clip = PIND_CLIP;
- rep->back_clip = PIND_CLIP;
- } /* ptk_setstandardviewport */
-
- /*--------------------------------------------------------------------------*/
- /*--------------------------- Post Functions -------------------------------*/
-
- /*function:external*/
- extern void ptk_poststruct(C(Pint) wsid, C(Pint) stid, C(Pfloat) priority)
- PreANSI(Pint wsid)
- PreANSI(Pint stid)
- PreANSI(Pfloat priority)
- /*
- ** \parambegin
- ** \param{Pint}{wsid}{workstation identifier}{IN}
- ** \param{Pint}{stid}{structure identifier}{IN}
- ** \param{Pfloat}{priority}{priority with which to post structure}{IN}
- ** \paramend
- ** \blurb{This function posts structure \pardesc{stid} to
- ** workstation \pardesc{wsid}, but only if the structure exists.}
- */
- {
- if (ptk_structexists(stid))
- ppost_struct(wsid, stid, priority);
- } /* ptk_poststruct */
-
- /*--------------------------------------------------------------------------*/
-
- typedef struct prirec
- {
- Pint ind;
- ptkboolean distinct;
- struct prirec *next;
- } prirec;
-
- /*--------------------------------------------------------------------------*/
-
- static void ptk_redistributepriorities(C(Pint) ws,
- C(Pposted_struct_list *) structlist)
- PreANSI(Pint ws)
- PreANSI(Pposted_struct_list *structlist)
- /*
- ** \parambegin
- ** \param{Pint}{ws}{workstation identifier}{IN}
- ** \param{Pposted\_struct\_list *}{structlist}{array of posted structures to reorder}{IN}
- ** \paramend
- ** \blurb{The priorities in the array are redistributed so that they
- ** are evenly spaced in the range 0-1 whilst retaining their relative
- ** ordering.
- ** For exam<ple, the set of priorities
- ** [0.1, 0.4, 0.45, 0.475, 0.4875, 0.5, 0.9, 0.95, 1]
- ** would become
- ** [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9].}
- */
- {
- Pint s, pricount;
- prirec *p, *prilist, *ptr;
- ptkboolean placefound, founddistinct;
- Pfloat currpriority, pristep;
-
- /* first order priorities into a linked list */
- prilist = (prirec *)malloc(sizeof(prirec));
- /* start list off with first priority in array */
- prilist->ind = 0;
- prilist->distinct = TRUE;
- prilist->next = NULL;
- pricount = 1;
- for (s = 0; s < structlist->num_postings; s++)
- {
- p = (prirec *)malloc(sizeof(prirec));
- p->ind = s;
- /* check against first item in list */
- if (structlist->postings[s].disp_pri ==
- structlist->postings[prilist->ind].disp_pri)
- {
- /* insert immediately after first entry in list */
- p->next = prilist->next;
- p->distinct = FALSE;
- prilist->next = p;
- }
- else
- if (structlist->postings[s].disp_pri <
- structlist->postings[prilist->ind].disp_pri)
- {
- /* insert point at start of list */
- p->next = prilist;
- p->distinct = TRUE;
- prilist = p;
- pricount++;
- }
- else
- {
- /* search down list until place is found */
- ptr = prilist;
- placefound = FALSE;
- while (ptr->next != NULL && !placefound)
- {
- if (structlist->postings[s].disp_pri ==
- structlist->postings[ptr->next->ind].disp_pri)
- {
- placefound = TRUE;
- /* insert priority 's' just after priority in list
- ** which is the same and don't increment 'pricount'
- */
- ptr = ptr->next;
- p->distinct = FALSE;
- continue;
- }
- if (structlist->postings[s].disp_pri <
- structlist->postings[ptr->next->ind].disp_pri)
- {
- placefound = TRUE;
- p->distinct = TRUE;
- pricount++;
- continue;
- }
- ptr = ptr->next;
- /* skip over repeated priorities in the list */
- founddistinct = FALSE;
- while (ptr->next != NULL && !founddistinct)
- {
- if (ptr->next->distinct)
- founddistinct = TRUE;
- else
- ptr = ptr->next;
- }
- }
- if (!placefound)
- {
- p->distinct = TRUE;
- pricount++;
- }
- /* insert priority at current place in list */
- p->next = ptr->next;
- ptr->next = p;
- }
- } /* for */
- /* 'pricount' now indicates how many distinct priorities there are,
- ** if there are n distinct priorities then divide the range [0,1] into n+1
- ** equal parts so that don't have to use priorities 0 and 1.
- */
- pristep = 1.0 / (pricount + 1);
- ptr = prilist;
- currpriority = 0.0;
- while (ptr != NULL)
- {
- if (ptr->distinct) /* increase current priority by one step */
- currpriority += pristep;
- structlist->postings[ptr->ind].disp_pri = currpriority;
- punpost_struct(ws, structlist->postings[ptr->ind].id);
- ppost_struct(ws, structlist->postings[ptr->ind].id, currpriority);
- p = ptr;
- ptr = ptr->next;
- free(p);
- }
- } /* ptk_redistributepriorities */
-
- /*--------------------------------------------------------------------------*/
-
- static void ptk_findpriority(C(Pint) ws, C(Prel_pri) relpriority,
- C(Pint) relstruct, C(Pfloat *) priority,
- C(Pint *) error)
- PreANSI(Pint ws)
- PreANSI(Prel_pri relpriority)
- PreANSI(Pint relstruct)
- PreANSI(Pfloat *priority)
- PreANSI(Pint *error)
- /*
- ** \parambegin
- ** \param{}{ws}{workstation identifier}{IN}
- ** \param{}{relpriority}{priority of posted structure relative to ref structure}{IN}
- ** \param{}{relstruct}{reference structure}{IN}
- ** \param{}{priority}{returned priority value}{OUT}
- ** \param{}{error}{error code}{OUT}
- ** \paramend
- ** \blurb{This is an internal procedure called by ptk_postrelative
- ** ptk_changepostpriority, to compute a structure priority given
- ** a reference structure and whether the new priority should be higher
- ** or lower than that of reference structure
- ** WARNING if the new priority requested can not be obtained, because
- ** of one of the following:
- ** 1. asking for a higher priority than 1
- ** 2. asking for lower priority than 0
- ** 3. there is insufficient gap between the priority of 'relstruct' and the
- ** next higher or lower priority to fit in a new priority
- **
- ** all the priorities on the workstation will be redistributed to regular
- ** intervals over the range [0,1].
- ** all the posted structures.}
- */
- {
- Pint numstructs, s;
- ptkboolean found, done;
- Pint relstruct_index, nearest, ind;
- Pfloat nearest_priority;
- Pposted_struct_list structlist;
-
- if (!ptk_structexists(relstruct))
- {
- *error = 1;
- return;
- }
- structlist.postings = NULL;
- pinq_posted_structs(ws, 0, 0, error, &structlist, &numstructs);
- structlist.postings = (Pposted_struct *)calloc(numstructs,
- sizeof(Pposted_struct));
- pinq_posted_structs(ws, numstructs, 0, error, &structlist, &numstructs);
-
- /* find position in array of 'relstruct'*/
- s = 0;
- found = FALSE;
- while ((s < numstructs) && (!found))
- {
- found = (structlist.postings[s].id == relstruct);
- if (!found)
- s++;
- }
- if (!found)
- {
- return;
- }
- *error = 0;
- relstruct_index = s;
-
- /* first check whether requesting higher priority than highest possible
- ** or lower priority than lowest possible.
- */
- if ((relpriority == PPRI_LOWER) &&
- (structlist.postings[relstruct_index].disp_pri == 0.0) ||
- ((relpriority == PPRI_HIGHER) &&
- (structlist.postings[relstruct_index].disp_pri == 1.0)))
- {
- /* redistribute all priorities on workstation to make room
- ** for a lower or higher priority
- */
- ptk_redistributepriorities(ws, &structlist);
- /* new priority is half way between new priority for 'relstruct'
- ** and 0 or 1, depending on 'relpriority'.
- */
- if (relpriority == PPRI_LOWER)
- *priority = structlist.postings[relstruct_index].disp_pri / 2.0;
- else
- *priority = (structlist.postings[relstruct_index].disp_pri + 1.0) / 2.0;
- return;
- }
-
- nearest = 0;
-
- if (relpriority == PPRI_LOWER)
- {
- nearest_priority = 0.0;
- for (s = 0; s < numstructs; s++)
- {
- if ((structlist.postings[s].disp_pri <
- structlist.postings[relstruct_index].disp_pri) &&
- (structlist.postings[s].disp_pri > nearest_priority))
- {
- nearest = s;
- nearest_priority = structlist.postings[s].disp_pri;
- }
- }
- }
- else
- {
- /* relpriority = PPRI_HIGHER */
- nearest_priority = 1.0;
- for (s = 0; s < numstructs; s++)
- {
- if ((structlist.postings[s].disp_pri >
- structlist.postings[relstruct_index].disp_pri) &&
- (structlist.postings[s].disp_pri < nearest_priority))
- {
- nearest = s;
- nearest_priority = structlist.postings[s].disp_pri;
- }
- }
- }
-
- /* new priority will be half way between priority of
- ** 'relstruct' and 'nearest_priority'.
- */
-
- *priority = (structlist.postings[relstruct_index].disp_pri +
- nearest_priority) / 2.0;
-
- /* if distance between priority of 'relstruct' and
- ** 'nearest_priority' is so small that new priority computed
- ** is approx equal to priority of 'relstruct', redistribute
- ** all priorities on workstation.
- */
- if (!ptk_equal(*priority, structlist.postings[relstruct_index].disp_pri))
- return;
- ptk_redistributepriorities(ws, &structlist);
- /* now recompute new priority as before, using new priorities
- ** for 'relstruct' and 'nearest'. If a priority just higher
- ** or lower than 'relstruct' was not found (in which case nearest
- ** is still 0) use 'nearest_priority' rather than priority for
- ** 'nearest' which will either be 0 or 1.
- */
- if (nearest != 0)
- *priority = (structlist.postings[relstruct_index].disp_pri +
- structlist.postings[nearest].disp_pri) / 2.0;
- else
- *priority = (structlist.postings[relstruct_index].disp_pri +
- nearest_priority) / 2.0;
- } /* ptk_findpriority */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_postrelative(C(Pint) ws, C(Pint) structid,
- C(Prel_pri) relpriority, C(Pint) relstruct,
- C(Pint *) error)
- PreANSI(Pint ws)
- PreANSI(Pint structid)
- PreANSI(Prel_pri relpriority)
- PreANSI(Pint relstruct)
- PreANSI(Pint *error)
- /*
- ** \parambegin
- ** \param{Pint}{ws}{workstation identifier}{IN}
- ** \param{Pint}{structid}{structure identifier}{IN}
- ** \param{Prel\_pri}{relpriority}{relative priority}{IN}
- ** \param{Pint}{relstruct}{relative structure identifier}{IN}
- ** \param{Pint *}{error}{error code}{OUT}
- ** \paramend
- ** \blurb{This function posts structure \pardesc{structid} at a priority higher or
- ** lower than that of structure \pardesc{relative structure identifier},
- ** according to \pardesc{relative priority}.
- ** If \pardesc{relative structure identifier} does not exist,
- ** \pardesc{error} is set to
- ** 1. Otherwise, its value is 0.}
- */
- {
- Pfloat priority;
-
- *error = 0;
- if (!ptk_structexists(structid))
- {
- printf("ptk_postrelative: %d doesn't exist\n", structid);
- *error = 1;
- }
- else
- {
- ptk_findpriority(ws, relpriority, relstruct, &priority, error);
- ppost_struct(ws, structid, priority);
- }
- } /* ptk_postrelative */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_changepostpriority(C(Pint) ws, C(Pint) structid,
- C(Prel_pri) relpriority, C(Pint) relstruct,
- C(Pint *) error)
- PreANSI(Pint ws)
- PreANSI(Pint structid)
- PreANSI(Prel_pri relpriority)
- PreANSI(Pint relstruct)
- PreANSI(Pint *error)
- /*
- ** \parambegin
- ** \param{Pint}{ws}{workstation identifier}{IN}
- ** \param{Pint}{structid}{structure identifier}{IN}
- ** \param{Prel\_pri}{relpriority}{relative priority}{IN}
- ** \param{Pint}{relstruct}{relative structure identifier}{IN}
- ** \param{Pint *}{error}{error code}{OUT}
- ** \paramend
- ** \blurb{This function changes the priority of structure \pardesc{structid}
- ** to immediately higher or lower than that of \pardesc{relstruct},
- ** according to \pardesc{relpriority}.
- ** If \pardesc{structid} does not exist,
- ** \pardesc{error} is set to
- ** 1. Otherwise, its value is 0.}
- */
- {
- Pfloat priority;
-
- *error = 0;
- if (!ptk_structexists(structid))
- {
- printf("ptk_changepostpriority: %d doesn't exist\n", structid);
- *error = 1;
- return;
- }
- ptk_findpriority(ws, relpriority, relstruct, &priority, error);
- punpost_struct(ws, structid);
- ppost_struct(ws, structid, priority);
- } /* ptk_changepostpriority */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_inqpostpriority(C(Pint) wsid, C(Pint) structid,
- C(Pfloat *) priority, C(Pint *) err)
- PreANSI(Pint wsid)
- PreANSI(Pint structid)
- PreANSI(Pfloat *priority)
- PreANSI(Pint *err)
- /*
- ** \parambegin
- ** \param{Pint}{wsid}{workstation identifier}{IN}
- ** \param{Pint}{structid}{structure identifier}{IN}
- ** \param{Pfloat *}{priority}{priority value}{IN}
- ** \param{Pint *}{err}{error indicator}{OUT}
- ** \paramend
- ** \blurb{This function may be used to obtain
- ** the priority of posted structure \pardesc{structid}.
- ** If \pardesc{structid} does not exist,
- ** \pardesc{err} is set to
- ** 1. If it is not posted to {\tt wsid} then {\tt err} is set to 2.}
- */
- {
- Pint numstructs, i;
- ptkboolean found;
- Pposted_struct_list structlist;
-
- *err = 0;
- if (!ptk_structexists(structid))
- {
- *err = 1;
- fprintf(stderr, "ptk_inqpostpriority: %d doesn't exist\n", structid);
- return;
- }
- structlist.postings = NULL;
- pinq_posted_structs(wsid, 0, 0, err, &structlist, &numstructs);
- structlist.postings = (Pposted_struct *)calloc(numstructs,
- sizeof(Pposted_struct));
- pinq_posted_structs(wsid, numstructs, 0, err, &structlist, &numstructs);
- i = 0;
- found = FALSE;
- while ((i < numstructs) && (!found))
- {
- found = (structlist.postings[i].id == structid);
- if (found)
- *priority = structlist.postings[i].disp_pri;
- else
- i++;
- }
- free(structlist.postings);
- if (!found)
- *err = 2;
- } /* ptk_inqpostpriority */
-
- /*--------------------------------------------------------------------------*/
- /*----------------------- Workstation Functions ----------------------------*/
-
- /*function:external*/
- extern void ptk_redrawallstructs(C(Pint) wsid, C(Pctrl_flag) flag)
- PreANSI(Pint wsid)
- PreANSI(Pctrl_flag flag)
- /*
- ** \parambegin
- ** \param{Pint}{wsid}{workstation identifier}{IN}
- ** \param{Pctrl\_flag}{flag}{control flag}{IN}
- ** \paramend
- ** \blurb{This function calls REDRAW ALL STRUCTURES only if the
- ** visual state of the workstation is deferred.}
- */
- {
- Pint err;
- Pdefer_mode defmode;
- Pmod_mode modmode;
- Pdisp_surf_empty disp;
- Pvisual_st vis;
-
- pinq_disp_upd_st(wsid, &err, &defmode, &modmode, &disp, &vis);
- if (vis == PVISUAL_ST_DEFER)
- predraw_all_structs(wsid, flag);
- } /* ptk_redrawallstructs */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_copycolourtable(C(Pint) sourcewsid, C(Pint) destwsid)
- PreANSI(Pint sourcewsid)
- PreANSI(Pint destwsid)
- /*
- ** \parambegin
- ** \param{Pint}{sourcewsid}{source workstation identifier}{IN}
- ** \param{Pint}{destwsid}{destination workstation identifier}{IN}
- ** \paramend
- ** \blurb{This function copies the colour
- ** table from workstation \pardesc{sourcewsid} to
- ** workstation \pardesc{destwsid}.}
- */
- {
- Pint_list colourind;
- Pint totlen, err, i, tablesize, wstype;
- Pcolr_rep rep;
- Pws_st_tables lengths;
- Pstore store;
- void *connid;
-
- pcreate_store(&err, &store);
- pinq_ws_conn_type(destwsid, store, &err, &connid, &wstype);
-
- /* Implementation dependent code - colour table size can be
- ** specified in open workstation in SUN.
- */
- #ifndef SUN
- pinq_ws_st_table(wstype, &err, &lengths);
- tablesize = lengths.colr_reps;
- #endif
- #ifdef SUN
- tablesize = (Pint)phigs_ws_type_get(wstype, PHIGS_COLOUR_TABLE_SIZE);
- #endif
-
- pinq_list_colr_inds(sourcewsid, 0, 0, &err, &colourind, &totlen);
- colourind.ints = (Pint *)calloc(totlen, sizeof(Pint));
- colourind.num_ints = totlen;
- pinq_list_colr_inds(sourcewsid, totlen, 0, &err, &colourind, &totlen);
- tablesize = PTKMIN(colourind.num_ints, tablesize);
- for (i = 0; i < tablesize; i++)
- {
- pinq_colr_rep(sourcewsid, colourind.ints[i], PINQ_SET, &err, &rep);
- pset_colr_rep(destwsid, colourind.ints[i], &rep);
- }
- ptk_delstore(store);
- free(colourind.ints);
- } /* ptk_copycolourtable */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_copylinetable(C(Pint) sourcewsid, C(Pint) destwsid)
- PreANSI(Pint sourcewsid)
- PreANSI(Pint destwsid)
- /*
- ** \parambegin
- ** \param{Pint}{sourcewsid}{source workstation identifier}{IN}
- ** \param{Pint}{destwsid}{destination workstation identifier}{IN}
- ** \paramend
- ** \blurb{This function copies the polyline bundle
- ** table from workstation \pardesc{sourcewsid} to
- ** workstation \pardesc{destwsid}.}
- */
- {
- Pint_list lineind;
- Pint totlen, err, i, tablesize, wstype;
- Pline_bundle rep;
- Pws_st_tables lengths;
- Pstore store;
- void *connid;
-
- pcreate_store(&err, &store);
- pinq_ws_conn_type(destwsid, store, &err, &connid, &wstype);
- pinq_ws_st_table(wstype, &err, &lengths);
- pinq_list_line_inds(sourcewsid, 0, 0, &err, &lineind, &totlen);
- lineind.ints = (Pint *)calloc(totlen, sizeof(Pint));
- lineind.num_ints = totlen;
- pinq_list_line_inds(sourcewsid, totlen, 0, &err, &lineind, &totlen);
- tablesize = PTKMIN(lengths.line_bundles, lineind.num_ints);
- for (i = 0; i < tablesize; i++)
- {
- pinq_line_rep(sourcewsid, lineind.ints[i], PINQ_SET, &err, &rep);
- pset_line_rep(destwsid, lineind.ints[i], &rep);
- }
- ptk_delstore(store);
- free(lineind.ints);
- } /* ptk_copylinetable */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_copymarkertable(C(Pint) sourcewsid, C(Pint) destwsid)
- PreANSI(Pint sourcewsid)
- PreANSI(Pint destwsid)
- /*
- ** \parambegin
- ** \param{Pint}{sourcewsid}{source workstation identifier}{IN}
- ** \param{Pint}{destwsid}{destination workstation identifier}{IN}
- ** \paramend
- ** \blurb{This function copies the polymarker bundle
- ** table from workstation \pardesc{sourcewsid} to
- ** workstation \pardesc{destwsid}.}
- */
- {
- Pint_list markerind;
- Pint totlen, err, i, tablesize, wstype;
- Pmarker_bundle rep;
- Pws_st_tables lengths;
- Pstore store;
- void *connid;
-
- pcreate_store(&err, &store);
- pinq_ws_conn_type(destwsid, store, &err, &connid, &wstype);
- pinq_ws_st_table(wstype, &err, &lengths);
- pinq_list_marker_inds(sourcewsid, 0, 0, &err, &markerind, &totlen);
- markerind.ints = (Pint *)calloc(totlen, sizeof(Pint));
- markerind.num_ints = totlen;
- pinq_list_marker_inds(sourcewsid, totlen, 0, &err, &markerind, &totlen);
- tablesize = PTKMIN(lengths.mark_bundles, markerind.num_ints);
- for (i = 0; i < tablesize; i++)
- {
- pinq_marker_rep(sourcewsid, markerind.ints[i], PINQ_SET, &err, &rep);
- pset_marker_rep(destwsid, markerind.ints[i], &rep);
- }
- ptk_delstore(store);
- free(markerind.ints);
- } /* ptk_copymarkertable */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_copytexttable(C(Pint) sourcewsid, C(Pint) destwsid)
- PreANSI(Pint sourcewsid)
- PreANSI(Pint destwsid)
- /*
- ** \parambegin
- ** \param{Pint}{sourcewsid}{source workstation identifier}{IN}
- ** \param{Pint}{destwsid}{destination workstation identifier}{IN}
- ** \paramend
- ** \blurb{This function copies the text bundle
- ** table from workstation \pardesc{sourcewsid} to
- ** workstation \pardesc{destwsid}.}
- */
- {
- Pint_list textind;
- Pint totlen, err, i, tablesize, wstype;
- Ptext_bundle rep;
- Pws_st_tables lengths;
- Pstore store;
- void *connid;
-
- pcreate_store(&err, &store);
- pinq_ws_conn_type(destwsid, store, &err, &connid, &wstype);
- pinq_ws_st_table(wstype, &err, &lengths);
- pinq_list_text_inds(sourcewsid, 0, 0, &err, &textind, &totlen);
- textind.ints = (Pint *)calloc(totlen, sizeof(Pint));
- textind.num_ints = totlen;
- pinq_list_text_inds(sourcewsid, totlen, 0, &err, &textind, &totlen);
- tablesize = PTKMIN(lengths.text_bundles, textind.num_ints);
- for (i = 0; i < tablesize; i++)
- {
- pinq_text_rep(sourcewsid, textind.ints[i], PINQ_SET, &err, &rep);
- pset_text_rep(destwsid, textind.ints[i], &rep);
- }
- ptk_delstore(store);
- free(textind.ints);
- } /* ptk_copytexttable */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_copyinttable(C(Pint) sourcewsid, C(Pint) destwsid)
- PreANSI(Pint sourcewsid)
- PreANSI(Pint destwsid)
- /*
- ** \parambegin
- ** \param{Pint}{sourcewsid}{source workstation identifier}{IN}
- ** \param{Pint}{destwsid}{destination workstation identifier}{IN}
- ** \paramend
- ** \blurb{This function copies the interior bundle
- ** table from workstation \pardesc{sourcewsid} to
- ** workstation \pardesc{destwsid}.}
- */
- {
- Pint_list intind;
- Pint totlen, err, i, tablesize, wstype;
- Pint_bundle rep;
- Pws_st_tables lengths;
- Pstore store;
- void *connid;
-
- pcreate_store(&err, &store);
- pinq_ws_conn_type(destwsid, store, &err, &connid, &wstype);
- pinq_ws_st_table(wstype, &err, &lengths);
- pinq_list_int_inds(sourcewsid, 0, 0, &err, &intind, &totlen);
- intind.ints = (Pint *)calloc(totlen, sizeof(Pint));
- intind.num_ints = totlen;
- pinq_list_int_inds(sourcewsid, totlen, 0, &err, &intind, &totlen);
- tablesize = PTKMIN(lengths.int_bundles, intind.num_ints);
- for (i = 0; i < tablesize; i++)
- {
- pinq_int_rep(sourcewsid, intind.ints[i], PINQ_SET, &err, &rep);
- pset_int_rep(destwsid, intind.ints[i], &rep);
- }
- ptk_delstore(store);
- free(intind.ints);
- } /* ptk_copyinttable */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_copyedgetable(C(Pint) sourcewsid, C(Pint) destwsid)
- PreANSI(Pint sourcewsid)
- PreANSI(Pint destwsid)
- /*
- ** \parambegin
- ** \param{Pint}{sourcewsid}{source workstation identifier}{IN}
- ** \param{Pint}{destwsid}{destination workstation identifier}{IN}
- ** \paramend
- ** \blurb{This function copies the edge bundle
- ** table from workstation \pardesc{sourcewsid} to
- ** workstation \pardesc{destwsid}.}
- */
- {
- Pint_list edgeind;
- Pint totlen, err, i, tablesize, wstype;
- Pedge_bundle rep;
- Pws_st_tables lengths;
- Pstore store;
- void *connid;
-
- pcreate_store(&err, &store);
- pinq_ws_conn_type(destwsid, store, &err, &connid, &wstype);
- pinq_ws_st_table(wstype, &err, &lengths);
- pinq_list_edge_inds(sourcewsid, 0, 0, &err, &edgeind, &totlen);
- edgeind.ints = (Pint *)calloc(totlen, sizeof(Pint));
- edgeind.num_ints = totlen;
- pinq_list_edge_inds(sourcewsid, totlen, 0, &err, &edgeind, &totlen);
- tablesize = PTKMIN(lengths.edge_bundles, edgeind.num_ints);
- for (i = 0; i < tablesize; i++)
- {
- pinq_edge_rep(sourcewsid, edgeind.ints[i], PINQ_SET, &err, &rep);
- pset_edge_rep(destwsid, edgeind.ints[i], &rep);
- }
- ptk_delstore(store);
- free(edgeind.ints);
- } /* ptk_copyedgetable */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_copyviewtable(C(Pint) sourcewsid, C(Pint) destwsid)
- PreANSI(Pint sourcewsid)
- PreANSI(Pint destwsid)
- /*
- ** \parambegin
- ** \param{Pint}{sourcewsid}{source workstation identifier}{IN}
- ** \param{Pint}{destwsid}{destination workstation identifier}{IN}
- ** \paramend
- ** \blurb{This function copies the view
- ** table from workstation \pardesc{sourcewsid} to
- ** workstation \pardesc{destwsid}.}
- */
- {
- Pint_list viewind;
- Pint totlen, err, i, tablesize, wstype;
- Pview_rep3 rep, currep;
- Pws_st_tables lengths;
- Pstore store;
- void *connid;
- Pupd_st updst;
-
- pcreate_store(&err, &store);
- pinq_ws_conn_type(destwsid, store, &err, &connid, &wstype);
- pinq_ws_st_table(wstype, &err, &lengths);
- pinq_list_view_inds(sourcewsid, 0, 0, &err, &viewind, &totlen);
- viewind.ints = (Pint *)calloc(totlen, sizeof(Pint));
- viewind.num_ints = totlen;
- pinq_list_view_inds(sourcewsid, totlen, 0, &err, &viewind, &totlen);
- tablesize = PTKMIN(lengths.view_reps, viewind.num_ints);
- for (i = 1; i < tablesize; i++)
- {
- pinq_view_rep(sourcewsid, viewind.ints[i], &err, &updst, &currep, &rep);
- pset_view_rep3(destwsid, viewind.ints[i], &rep);
- }
- ptk_delstore(store);
- free(viewind.ints);
- } /* ptk_copyviewtable */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_copypattable(C(Pint) sourcewsid, C(Pint) destwsid)
- PreANSI(Pint sourcewsid)
- PreANSI(Pint destwsid)
- /*
- ** \parambegin
- ** \param{Pint}{sourcewsid}{source workstation identifier}{IN}
- ** \param{Pint}{destwsid}{destination workstation identifier}{IN}
- ** \paramend
- ** \blurb{This function copies the pattern bundle
- ** table from workstation \pardesc{sourcewsid} to
- ** workstation \pardesc{destwsid}.}
- */
- {
- Pint_list patind;
- Pint totlen, err, i, tablesize, wstype;
- Ppat_rep *rep;
- Pws_st_tables lengths;
- Pstore store, patstore;
- void *connid;
-
- #ifndef HP
- pcreate_store(&err, &store);
- pinq_ws_conn_type(destwsid, store, &err, &connid, &wstype);
- pinq_ws_st_table(wstype, &err, &lengths);
- pinq_list_pat_inds(sourcewsid, 0, 0, &err, &patind, &totlen);
- patind.ints = (Pint *)calloc(totlen, sizeof(Pint));
- patind.num_ints = totlen;
- pinq_list_pat_inds(sourcewsid, totlen, 0, &err, &patind, &totlen);
- tablesize = PTKMIN(lengths.pat_reps, patind.num_ints);
- for (i = 0; i < tablesize; i++)
- {
- pcreate_store(&err, &patstore);
- pinq_pat_rep(sourcewsid, patind.ints[i], PINQ_SET, patstore, &err, &rep);
- pset_pat_rep(destwsid, patind.ints[i], rep);
- ptk_delstore(patstore);
- }
- ptk_delstore(store);
- free(patind.ints);
- #endif
- } /* ptk_copypattable */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_copywssttable(C(Pint) sourcewsid, C(Pint) destwsid)
- PreANSI(Pint sourcewsid)
- PreANSI(Pint destwsid)
- /*
- ** \parambegin
- ** \param{Pint}{sourcewsid}{source workstation identifier}{IN}
- ** \param{Pint}{destwsid}{destination workstation identifier}{IN}
- ** \paramend
- ** \blurb{This function copies the workstation colour,
- ** polyline bundle, polymarker bundle, interior bundle, edge bundle,
- ** text bundle, pattern bundle and view
- ** tables from workstation \pardesc{sourcewsid} to
- ** workstation \pardesc{destwsid}.}
- */
- {
- /* colour table */
- ptk_copycolourtable(sourcewsid, destwsid);
- /* polyline table */
- ptk_copylinetable(sourcewsid, destwsid);
- /* polymarker table */
- ptk_copymarkertable(sourcewsid, destwsid);
- /* interior table */
- ptk_copyinttable(sourcewsid, destwsid);
- /* edge table */
- ptk_copyedgetable(sourcewsid, destwsid);
- /* text table */
- ptk_copytexttable(sourcewsid, destwsid);
- /* pattern table */
- ptk_copypattable(sourcewsid, destwsid);
- /* view table */
- ptk_copyviewtable(sourcewsid, destwsid);
- } /* ptk_copywssttable */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_copypostedstruct(C(Pint) sourcewsid, C(Pint) destwsid)
- PreANSI(Pint sourcewsid)
- PreANSI(Pint destwsid)
- /*
- ** \parambegin
- ** \param{Pint}{sourcewsid}{source workstation identifier}{IN}
- ** \param{Pint}{destwsid}{destination workstation identifier}{IN}
- ** \paramend
- ** \blurb{This function posts all the structures already posted to
- ** workstation \pardesc{sourcewsid} to workstation \pardesc{destwsid}.}
- */
- {
- Pint err, totlen, i;
- Pposted_struct_list postlist;
-
- pinq_posted_structs(sourcewsid, 0, 0, &err, &postlist, &totlen);
- postlist.postings = (Pposted_struct *)calloc(totlen,
- sizeof(Pposted_struct));
- postlist.num_postings = totlen;
- pinq_posted_structs(sourcewsid, totlen, 0, &err, &postlist, &totlen);
- for (i = 0; i < postlist.num_postings; i++)
- ppost_struct(destwsid, postlist.postings[i].id,
- postlist.postings[i].disp_pri);
- free(postlist.postings);
- } /* ptk_copypostedstruct */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_copyhilightfilter(C(Pint) sourcewsid, C(Pint) destwsid)
- PreANSI(Pint sourcewsid)
- PreANSI(Pint destwsid)
- /*
- ** \parambegin
- ** \param{Pint}{sourcewsid}{source workstation identifier}{IN}
- ** \param{Pint}{destwsid}{destination workstation identifier}{IN}
- ** \paramend
- ** \blurb{This function copies the highlighting filter
- ** from workstation \pardesc{sourcewsid} to workstation \pardesc{destwsid}.}
- */
- {
- Pint err;
- Pstore store;
- Pfilter *highfilt;
-
- /* highlight filter */
- pcreate_store(&err, &store);
- pinq_highl_filter(sourcewsid, store, &err, &highfilt);
- pset_highl_filter(destwsid, highfilt);
- ptk_delstore(store);
- } /* ptk_copyhilightfilter */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_copyinvisfilter(C(Pint) sourcewsid, C(Pint) destwsid)
- PreANSI(Pint sourcewsid)
- PreANSI(Pint destwsid)
- /*
- ** \parambegin
- ** \param{Pint}{sourcewsid}{source workstation identifier}{IN}
- ** \param{Pint}{destwsid}{destination workstation identifier}{IN}
- ** \paramend
- ** \blurb{This function copies the invisibilty filter
- ** from workstation \pardesc{sourcewsid} to workstation \pardesc{destwsid}.}
- */
- {
- Pint err;
- Pstore store;
- Pfilter *invisfilt;
-
- /* invisibility filter */
- pcreate_store(&err, &store);
- pinq_invis_filter(sourcewsid, store, &err, &invisfilt);
- pset_invis_filter(destwsid, invisfilt);
- ptk_delstore(store);
- } /* ptk_copyinvisfilter */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_copyhlhsrmode(C(Pint) sourcewsid, C(Pint) destwsid)
- PreANSI(Pint sourcewsid)
- PreANSI(Pint destwsid)
- /*
- ** \parambegin
- ** \param{Pint}{sourcewsid}{source workstation identifier}{IN}
- ** \param{Pint}{destwsid}{destination workstation identifier}{IN}
- ** \paramend
- ** \blurb{This function copies the HLHSR mode
- ** from workstation \pardesc{sourcewsid} to workstation \pardesc{destwsid}.}
- */
- {
- /* inquire hlhsr mode */
- /* inquire wstype */
- /* inquire hlhsr facilities */
- /* if mode available set otherwise default */
- } /* ptk_copyhlhsrmode */
-
- /* copy workstation window, workstation viewport, deferral mode,
- ** modification mode, colour model, input devices.
- */
-
- /*--------------------------------------------------------------------------*/
- /*------------------------ Inquiry Functions -------------------------------*/
-
- /*function:external*/
- extern void ptk_inqmaxdevicecoords(C(Pint) wsid, C(Pfloat *) maxdevx,
- C(Pfloat *) maxdevy)
- PreANSI(Pint wsid)
- PreANSI(Pfloat *maxdevx)
- PreANSI(Pfloat *maxdevy)
- /*
- ** \parambegin
- ** \param{Pint}{wsid}{workstation identifier}{IN}
- ** \param{Pfloat *}{maxdevx}{maximum device coords along x axis}{OUT}
- ** \param{Pfloat *}{maxdevy}{maximum device coords along y axis}{OUT}
- ** \paramend
- ** \blurb{This function returns the the
- ** maximum device coordinates for $x$ and $y$ for workstation \pardesc{wsid}.}
- */
- {
- Pint err, wstype;
- Pdisp_space_size disprec;
- Pstore store;
- void *connid;
-
- pcreate_store(&err, &store);
- pinq_ws_conn_type(wsid, store, &err, &connid, &wstype);
- pinq_disp_space_size(wstype, &err, &disprec);
- *maxdevx = disprec.size_dc.size_x;
- *maxdevy = disprec.size_dc.size_y;
- ptk_delstore(store);
- } /* ptk_inqmaxdevicecoords */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_inqmaxdevicecoords3(C(Pint) wsid, C(Pfloat *) maxdevx,
- C(Pfloat *) maxdevy, C(Pfloat *) maxdevz)
- PreANSI(Pint wsid)
- PreANSI(Pfloat *maxdevx)
- PreANSI(Pfloat *maxdevy)
- PreANSI(Pfloat *maxdevz)
- /*
- ** \parambegin
- ** \param{Pint}{wsid}{workstation identifier}{IN}
- ** \param{Pfloat *}{maxdevx}{maximum device coords along x axis}{OUT}
- ** \param{Pfloat *}{maxdevy}{maximum device coords along y axis}{OUT}
- ** \param{Pfloat *}{maxdevz}{maximum device coords along z axis}{OUT}
- ** \paramend
- ** \blurb{This function returns the the
- ** maximum device coordinates for $x$, $y$
- ** and $z$ for workstation \pardesc{wsid}.}
- */
- {
- Pint err, totsize;
- Pint wstype;
- Pdisp_space_size3 disprec;
- Pstore store;
- void *connid;
-
- pcreate_store(&err, &store);
- pinq_ws_conn_type(wsid, store, &err, &connid, &wstype);
- pinq_disp_space_size3(wstype, &err, &disprec);
- *maxdevx = disprec.size_dc.size_x;
- *maxdevy = disprec.size_dc.size_y;
- *maxdevz = disprec.size_dc.size_z;
- ptk_delstore(store);
- } /* ptk_inqmaxdevicecoords3 */
-
- /*--------------------------------------------------------------------------*/
- /*---------------------- Miscellaneous Functions ---------------------------*/
-
- static void box(C(Ppoint *) pos, C(Pint) c, C(Ppoint *) size)
- PreANSI(Ppoint *pos)
- PreANSI(Pint c)
- PreANSI(Ppoint *size)
- /*
- ** \parambegin
- ** \param{}{xx}{position of box on x axis}{IN}
- ** \param{}{yy}{position of box on y axis}{IN}
- ** \param{}{c}{interior colour of box (index to colour table)}{IN}
- ** \param{}{boxptr}{pointer to ptkscolourtable struct}{IN}
- ** \paramend
- ** \blurb{Draws a box and fills with given colour.}
- */
- {
- Ppoint boxcoords[4];
- Ppoint textpoint;
- char textnum[5];
- Ppoint_list boxpts;
-
- textpoint.x = pos->x + size->x / 2.0;
- textpoint.y = pos->y + size->y / 2.0;
-
- boxcoords[0] = ptk_point(pos->x, pos->y);
- boxcoords[1] = ptk_point(pos->x + size->x, pos->y);
- boxcoords[2] = ptk_point(pos->x + size->x, pos->y + size->y);
- boxcoords[3] = ptk_point(pos->x, pos->y + size->y);
-
- sprintf(textnum, "%d", c);
- if (c >= 0)
- {
- pset_int_colr_ind(c);
- boxpts.num_points = 4;
- boxpts.points = boxcoords;
- pfill_area(&boxpts);
- ptext(&textpoint, textnum);
- }
- } /* box */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_drawcolourtable(C(Pint) stid, C(Pint) llim, C(Pint) ulim)
- PreANSI(Pint stid)
- PreANSI(Pint llim)
- PreANSI(Pint ulim)
- /*
- ** \parambegin
- ** \param{Pint}{stid}{structure identifier}{IN}
- ** \param{Pint}{llim}{lower index value of colour table range}{IN}
- ** \param{Pint}{ulim}{upper limit of colour table range.}{IN}
- ** \paramend
- ** \blurb{This function draws a rectangular array of boxes representing
- ** the range \pardesc{llim} to \pardesc{ulim} of
- ** the workstation colour table. The boxes are drawn into structure
- ** \pardesc{stid}.}
- */
- {
- Pint x, y, numboxes, cindex;
- Ptext_align alignrec;
- Pfloat entryrange;
- Ppoint size, pos;
-
- entryrange = (Pfloat)(ulim - llim + 1);
- entryrange = sqrt(entryrange);
- /* numboxes = number of boxes down each side of grid */
- numboxes = (entryrange/1);
- if (entryrange > numboxes) { numboxes++; }
-
- size.x = 1.0 / numboxes;
- size.y = 1.0 / numboxes;
- alignrec.hor = PHOR_CTR;
- alignrec.vert = PVERT_HALF;
-
- ptk_openstruct(stid);
- pset_text_align(&alignrec);
- pset_char_ht(size.y / 4.0);
- pset_int_style(PSTYLE_SOLID);
- for (y = 0; y < numboxes; y++)
- {
- for (x = 0; x < numboxes; x++)
- {
- pos = ptk_point((Pfloat)x * size.x, 1.0 - ((Pfloat)(y + 1) * size.y));
- cindex = (y * numboxes) + x + llim;
- if (cindex > ulim)
- cindex = -1;
- box(&pos, cindex, &size);
- }
- }
- ptk_closestruct();
- } /* ptk_drawcolourtable */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_arrow(C(Pfloat) length, C(Pfloat) width, C(Ppoint3 *) centre,
- C(Pfloat) angle)
- PreANSI(Pfloat length)
- PreANSI(Pfloat width)
- PreANSI(Ppoint3 *centre)
- PreANSI(Pfloat angle)
- /*
- ** \parambegin
- ** \param{Pfloat}{length}{length of arrow}{IN}
- ** \param{Pfloat}{width}{width of arrow}{IN}
- ** \param{Ppoint3 *}{centre}{centre of arrow}{IN}
- ** \param{Pfloat}{angle}{rotation of arrow in degrees anti-clockwise about
- ** arrow pointing along x-axis.}{IN}
- ** \paramend
- ** \blurb{This function draws an arrow with the specified
- ** length \pardesc{length} and \pardesc{width}, rotated through
- ** \pardesc{angle}, centred at \pardesc{centre}.}
- */
- {
- Pmatrix3 matrix;
- Ppoint3 fp[7];
- Pint i;
- Ppoint_list3 sets;
-
- ptk_rotate3(angle, 3, PTYPE_REPLACE, matrix);
- ptk_shift3(centre, PTYPE_POSTCONCAT, matrix);
- fp[0] = ptk_point3(-width/4.0, -length/2.0, 0.0);
- fp[1] = ptk_point3(fp[0].x, length/6.0, 0.0);
- fp[2] = ptk_point3(-width/2.0, fp[1].y, 0.0);
- fp[3] = ptk_point3(0.0, -fp[0].y, 0.0);
- fp[4] = ptk_point3(width/2.0, fp[1].y, 0.0);
- fp[5] = ptk_point3(-fp[0].x, fp[1].y, 0.0);
- fp[6] = ptk_point3(fp[5].x, fp[0].y, 0.0);
- for (i = 0; i < 7; i++)
- fp[i] = ptk_transform3(matrix, &fp[i]);
- sets.num_points = 7;
- sets.points = fp;
- ptk_fillareaset3(1, &sets);
- } /* ptk_arrow */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_grid(C(Pint) stid)
- PreANSI(Pint stid)
- /*
- ** \parambegin
- ** \param{Pint}{stid}{grid structure identifier}{IN}
- ** \paramend
- ** \blurb{This functions draws a grid of lines on [0,1],
- ** into structure \pardesc{stid}. }
- */
- {
- Pint i;
- Ppoint pts[2], textpt;
- Ptext_align al;
- char str[80];
- Ppoint_list gridpts;
-
- gridpts.num_points = 2;
- gridpts.points = pts;
- ptk_openstruct(stid);
- al.hor = PHOR_CTR;
- al.vert = PVERT_NORM;
- pset_text_align(&al);
- pset_char_ht(0.01);
- for (i = 1; i <= 9; i++)
- {
- /* horizontal lines, x = 0.1,..,0.9 */
- pts[0] = ptk_point((Pfloat)i * 0.1, 0.93);
- pts[1] = ptk_point((Pfloat)i * 0.1, 0.07);
- ppolyline(&gridpts);
- sprintf(str, "%d", i);
- textpt = ptk_point(i * 0.1, 0.94);
- ptext(&textpt, str);
- textpt = ptk_point(i * 0.1, 0.04);
- ptext(&textpt, str);
- }
-
- al.hor = PHOR_NORM;
- al.vert = PVERT_HALF;
- pset_text_align(&al);
- for (i = 1; i <= 9; i++)
- {
- /* vertical lines, y = 0.1,..,0.9 */
- pts[0] = ptk_point(0.07, i * 0.1);
- pts[1] = ptk_point(0.93, i * 0.1);
- ppolyline(&gridpts);
- sprintf(str, "%d", i);
- textpt = ptk_point(0.03, i * 0.1);
- ptext(&textpt, str);
- textpt = ptk_point(0.94, i * 0.1);
- ptext(&textpt, str);
- }
- ptk_closestruct();
- } /* ptk_grid */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_framebox(C(Ppoint3 *) boxcentre, C(Ppoint *) boxsize,
- C(Ppoint *) framesize, C(Pint) boxcolour, C(Pint) edgecolour,
- C(Pint) tlcolour, C(Pint) brcolour)
- PreANSI(Ppoint3 *boxcentre)
- PreANSI(Ppoint *boxsize)
- PreANSI(Ppoint *framesize)
- PreANSI(Pint boxcolour)
- PreANSI(Pint edgecolour)
- PreANSI(Pint tlcolour)
- PreANSI(Pint brcolour)
- /*
- ** \parambegin
- ** \param{Ppoint3 *}{boxcentre}{centre of box}{IN}
- ** \param{Ppoint *}{boxsize}{height and width box}{IN}
- ** \param{Ppoint *}{framesize}{height and width of frame}{IN}
- ** \param{Pint}{boxcolour}{box interior colour index}{IN}
- ** \param{Pint}{edgecolour}{box edge colour index}{IN}
- ** \param{Pint}{tlcolour}{frame top-left colour index}{IN}
- ** \param{Pint}{brcolour}{frame bottom-right colour index}{IN}
- ** \paramend
- ** \blurb{This function draws a box in the open
- ** structure with a frame to give a 3D
- ** effect.}
- */
- {
- Ppoint3 pts[6];
- Ppoint_list3 sets, areapts;
-
- pset_int_style(PSTYLE_SOLID);
- pts[0] = ptk_point3(boxcentre->x - (boxsize->x / 2.0) - framesize->x,
- boxcentre->y - (boxsize->y / 2.0) - framesize->y,
- boxcentre->z);
- pts[1] = ptk_point3(pts[0].x, pts[0].y + boxsize->y + (2.0 * framesize->y),
- boxcentre->z);
- pts[2] = ptk_point3(pts[0].x + boxsize->x + (2.0 * framesize->x), pts[1].y,
- boxcentre->z);
- pts[3] = ptk_point3(pts[2].x - framesize->x,
- pts[2].y - framesize->y, boxcentre->z);
- pts[4] = ptk_point3(pts[1].x + framesize->x, pts[3].y,
- boxcentre->z);
- pts[5] = ptk_point3(pts[4].x, pts[0].y + framesize->y,
- boxcentre->z);
-
- pset_int_colr_ind(tlcolour);
- pts[2] = ptk_point3(pts[0].x + boxsize->x + (2.0 * framesize->x), pts[1].y,
- boxcentre->z);
- areapts.num_points = 6;
- areapts.points = pts;
- pset_edge_flag(PEDGE_OFF);
- pfill_area3(&areapts);
-
- pset_int_colr_ind(brcolour);
- pts[1].x += boxsize->x + (2.0 * framesize->x);
- pts[1].y -= boxsize->y + (2.0 * framesize->y);
- pts[4].x = pts[3].x;
- pts[4].y = pts[5].y;
- pfill_area3(&areapts);
-
- pts[2] = ptk_point3(pts[3].x, pts[5].y, boxcentre->z);
- pts[4] = ptk_point3(pts[0].x + framesize->x, pts[3].y,
- boxcentre->z);
- pset_int_colr_ind(boxcolour);
- pset_edge_flag(PEDGE_ON);
- pset_edge_colr_ind(edgecolour);
- sets.num_points = 4;
- sets.points = &pts[2];
- ptk_fillareaset3(1, &sets);
- } /* ptk_framebox */
-
- /*--------------------------------------------------------------------------*/
-
- /* phigslib */
-
- /* End. */
-